Deliberate Practice in Competitive Programming
Disclaimer, I’m far from a legend at competitive programming, I’m blue on codeforces and I will participate on IOI, I believe though that I know enough about CP and teaching that I can make some contribution
When you ask on forums about becoming red in codeforces, topcoder or atcode or how to get a gold medal in IOI, most people just say things like “practice, practice, practice” or “solve as many problems as you can”, but while this is better than nothing, it’s not the whole truth and is in fact a quite inefficient way to train. As many studies show, normal practice will show slow progress and sometimes your abilities will even deteriorate a little. What one needs in fact is “deliberate practice”, a way to practice with focus and feedback, that was shown to be extremelly more efficient than normal practice methods.
What is deliberate Practice
Deliberate practice can be summed up as: break what you want to train in small subskills, practice one of them with 100% focus, get feedback, rinse and repeat. One thing that is important is that you get a coach or at least a training partner, that way, getting feedack will be easier, though you can still use most of this approach without having someone helping you out.
Competitive Programming Sub-skills
Broadly speaking there are 3 parts to solving a problem, identifying the technique you will need (or whether it’s ad-hoc), planning a solution and implementing a solution. So that’s a possible way to break CP in sub-skills, but we need to be a little more fine-grained, so we will break the last two into the “tags”: ad-hoc, data structures, dynamic programming, geometry, graphs and math (it can be divided even further, but for this post that will suffice).
Training
First of all you should either ask someone to select your problems based on the subskill or select them yourself, second you should remove as many distractions as possible (turn-off your phone, use extensions that stop you from browsing the web for a while) and then start solving the chosen problems.
Choosing the appropriate problems
After choosing the specific sub-skill, you will choose problems in 3 broad categories, easy (you can solve 70%+ of them), medium (you can solve between 40 and 70% of them) and hard (you can solve less than 40% of them), generally speaking there will be some way to do this, for example codeforces has 3 divisions and the problems are sorted by difficulty, atcoder and topcoder are similar, while for IOI you have many countries OI’s. Depending on your available time, set a target number of problems and select them so that 15% are easy, 70% are medium and the other 15% are hard.
Solving problems
First try to solve the problem with no external help, after the time you set for this problem is over you can either ask for a small tip from your coach/training partner or you can read the first few lines of the editorial, until you learn something new about the solution that you didn’t know before. Now you try to finish the problem, but only with half of the original time, repeat this, halving the alloted time in every step, until either you solve the problem or you have read the full editorial and an AC code.
Logging your mistakes and feedback
In case you couldn’t solve the problem on your own you should save the problem link and a quick phrase explaining why you couldn’t solve it in a file titled “this month’s log”, like “I didn’t realize it was a graphs problem”, or “I didn’t think about the correct dp transition”, if the problem was lack of knowledge of some topic (“don’t know how to code aho-cosarick”) then you should take some time to study the algorithm and implement it. At the end of the month you should go back to the file and try to solve each problem again to practice your weaknesses one more time. It’s also nice to eventually look back and see how much you improved.
Some other ways to train
The last few topics taught you how to train for tags and problem-solving, but there are two other things worth training, speed and contests. For speed you should do the same as above, but with 60% easy problems and 40% medium, while also using a timer to see how long you take from reading the problem to AC. Now for the contests themselves you should simply try to do a “virtual participation” once every week, logging your performace once the virtual contest is over.
Overcoming a plateau
Sometimes while training you may feel that you are not improving at all, when this happens we say that you’ve “hit a plateau”. When something like that happens you should attempt to temporarily increase the difficulty of your trainings, so when choosing your problems for practice you should aim for 60% medium and 40% hard. After doing that for around one or two weeks you should scale back the difficulty, hopefully you will start improving again.
Resources
Ahmed Aly has a2oj ladders which help a lot with sorting problems by their difficulty in codeforces.
AtCoder problem list where you can also search which problems you solved