small upd to ad hoc, modules

This commit is contained in:
Michael Cao 2020-07-16 10:49:13 -05:00
parent 3f1d5acd5d
commit 076f938606
2 changed files with 10 additions and 8 deletions

View file

@ -99,13 +99,13 @@ The code we provide will generally follow the conventions below. Please note tha
```
</li>
<li>
Binary operators should be spaced on both sides. For example, `a+b` should be written as `a + b` and `x=a+3` should be written as `x = a + b`.
Binary operators should be spaced on both sides. For example, `a+b` should be written as `a + b` and `x=a+b` should be written as `x = a + b`.
</li>
<li>
Unary operators can be not spaced or spaced on the left side. For example, to decrement a value, write `x--` and a negative value should be written as `x = -y`.
Unary operators can be not spaced or spaced on the left side, such as `x--` and `x = -y`.
</li>
<li> Use make_pair rather than {} to store a pair. </li>
<li> Use `using namespace std` rather than `std::` </li>
<li> Use `using namespace std` rather than `std::`. </li>
<li> Use `struct` instead of `class`. </li>
<li> Use `auto` when dealing with structs or iterators. </li>
<li> Use `true / false` for boolean values, not `1 / 0`. </li>

View file

@ -16,7 +16,7 @@ export const metadata = {
],
greedyTutorial: [
new Problem("Bronze", "Mad Scientist", "1012", "Normal", false, [], ""),
]
],
}
};
@ -32,7 +32,7 @@ Since Ad Hoc problems don't fall under any specific category, they can be hard t
<li> Try to approach the problem from a lot of different perspectives. Try to draw a visual depiction of the problem, mess around with formulas, or model it as a Graph Theory problem (see Graph Theory module). One of the most helpful things you can do when solving Ad Hoc problems is to keep trying ideas until you make progress. This is something you get better at as you do more problems.</li>
</ul>
These tips are very useful in solving Ad Hoc problems. However, in the end, the best way to get better at Ad Hoc problems (or any type of problems) is to do a lot of them. Try to solve as many practice problems below as you can, and click the solution sketch tab if you can't figure the solution out.
These tips are helpful in solving Ad Hoc problems. However, in the end, the best way to get better at Ad Hoc problems (or any type of problems) is to do a lot of them. Try to solve as many practice problems below as you can, and click the solution sketch tab if you can't figure the solution out.
## Greedy Problems
@ -48,13 +48,15 @@ Consider some possible greedy algorithms for the USACO Bronze problem "Mad Scien
In this problem, the correct greedy solution is to continually flip the longest possible ranges of mismatching cows.
Mad Scientist has an excellent [editorial](http://www.usaco.org/current/data/sol_breedflip_bronze_feb20.html) with a video solution and intuitive proof. It is highly recommended you read it before continuing to gain a better understanding of the greedy algorithm.
Mad Scientist has an excellent [editorial](http://www.usaco.org/current/data/sol_breedflip_bronze_feb20.html) with a video solution and intuitive proof.
It is highly recommended you read it to gain a better understanding of the greedy algorithm.
</spoiler>
However, not all greedy problems in the bronze division nessecarily require mathematical proofs of correctness. It is often good enough to intuitively convince yourself your algorithm is correct.
However, not all greedy problems in the bronze division necessarily require mathematical proofs of correctness. It is often sufficent to intuitively convince yourself your algorithm is correct.
<info-block title="Pro Tip">
Sometimes, if the algorithm is easy enough to implement, you don't even need to convince yourself it's correct: just let the online judge prove it for you by coding it and seeing if it passes. This is often called a Proof by AC.
Sometimes, if the algorithm is easy enough to implement, you don't even need to convince yourself it's correct: just let the online judge prove it for you by coding it and seeing if it passes. Competitive programmers refer to this as "Proof by AC," or "Proof by Accepted."
<!-- Don't overuse it though? -->