Competitive programming
Competitive programming
Overall goal: You should start to be able to implement solutions to problems in c++. As you are
just starting, the priority is to get used to the syntax of the language and the workflow of solving
problems. Don’t focus on mastering the language, and if something comes up frequently, learn
it!
How to practice: You should be mainly doing questions on Hackerrank as they tend to be
easier and they also have a section for c++. You can also start doing problems on Codeforces
(the main cp website, but not used that much for IOI training). On codeforces, stick to
800-rated problems that have the most accepted solutions. The codeforces problems tend to
have ‘trick solutions’, by that I mean they are long and heavy-implemented problems but instead
some mathematical trick that can be solved with some basic loops and formulas.
Overall goal: Familiarise yourself with USACO bronze problems. You should understand how
to solve complete search problems, basic greedy problems and ad-hoc problems (i.e. random).
In addition, you should also try to finish both AoPS books as a strong mathematical background
is necessary in CP.
How to practice: 100% USE THE USACO GUIDE!!! This should be your number one resource
from now on and the rest of this document will loosely be based on this. USACO has excellent
problems and the guide is so helpful (I use this to practice problems). Here is a link: USACO
guide
Overall goal: Start solving problems that involve an algorithmic approach. They can increase
efficiency and make you a better CP. Also start learning the basics of bitwise operations. Prefix
sums are good at saving you runtime and binary search should always be used in monotonic
sequences. Priority queues and stacks will be helpful soon. They should still be learnt.
How to practice: Start solving USACO silver problems, and do a lot more codeforces 1000-
1500. Use codeforces, USACO problems and NEW!: AtCoder. They have more
math/algorithmic problems, but they can be really hard at IOI level.
Overall goal: You should now become comfortable approaching and solving most DP
problems. You can identify when to use DP (versus greedy) and solve problems at the USACO
gold level.
How to practice: Once again use the USACO training guide, Codeforces, atCoder. Use
leetcode to solve the classical DP problems and get used to solving them. Leetcode has more
transparent problems but I use leetcode problems when learning a new topic.
I apologize. I have left this out and it is really REALLY REALLY important in CP (and CS).
However I feel like it's best dedicated by itself as the amount of data structures and algorithms
are insane. Enjoy (I don’t know much about graphs yet, but I will tell you the two best resources
for learning graphs):
Resource 1: USACO guide. Graphs are covered in USACO silver, USACO gold and a bit more
in USACO platinum. Learn everything there is to know about graphs, from the very basics to the
most complex.
Resource 2: Competitive programming 4 (Steven Halim, Felix Halim). I use this book to learn
about CP concepts and their graph section is very good and very comprehensive. You can
probably find a pdf of the book online on a github repo.
Overall goal: Essentially learn all there is to learn about graphs. Representations, variations,
traversals, pathfinding, proofs etc.
Remaining:
Now that you know all the fundamentals to CP, if you have spent more time that allocated to
each section don’t worry. Now you can start to dive into more specific things such as heavy-light
decomposition, fft, centroid decomposition. Please use the USACO guide and the 2nd book to
the one mentioned in the graph section. From this point now, you should start to slowly solve
more Olympiad problems, whether it's the IOI or national olympiads. You can start doing more
practice contests and solving more problems. You have reached the stage of refinement and
are now preparing for your International olympiads. Good job!