I generally don't like to give much advice on "how to practice", but recently I have been thinking a lot about this and I realized that there is something that I believe affects a lot of people (though it is admittedly hard to tell) that barely gets talked about: self-deception.
Self-deception is a devious thing. It can be very hard to detect, yet can be fatal to improvement.
This blog is mainly directed to greys, greens and cyans that can't get out of these categories. Most examples are given with that in mind. That being said, I believe others have something to think about as well.
This is my first blog on such "psychological issues" and I don't know if I'll ever make another one. It's certainly a difficult topic to write about because for most of the blog, the message is "your practice is not as good as you think it is" or even "you aren't as good as you think you are" which can of course be a hard thing to hear. Thus, I have to somehow be very gentle while getting the point across, and I'm not sure how well I can even do either of these things individually. I also want to stress that nothing in this blog applies to everyone and nothing in this blog applies to everything you do.
Read this blog carefully. More than once I have explained these ideas and people just walk away with what they wanted to hear about "how to practice". I don't want to see this again.
I want to thank poomas, nor, SlavicG and OmniMan for reviewing this blog.
My sad story
To start, I'll give a personal story as to not seem like I'm talking from a high horse. Self-deception can affect anyone. Let me tell you something about my practice history. Somewhere in late 2019 and early 2020 I started to really like doing virtual contests. I enjoyed the process of doing them and started doing them every day, usually in the morning. For a while it was very fruitful. You can see the linear increase in my rating between January and August of 2020. I also upsolved, of course, but the rise in rating was in no small part due to these virtuals.
After a while, something happened though. For whatever random reason, I became slightly less interested in CP stuff, but I still did these daily virtual contests. However, something changed: I started to treat the virtual contests as a chore and got lazy. It is an exaggeration, but sometimes I felt like I slogged through them — just kinda did them, with overall less interest in solving the very hard problems. I still did the virtual contests like before and from the outside, it may seem as though nothing had changed. But in the inside, I no longer made a so serious effort to study and understand the problems so deeply.
What are the takeaways from this story?
- It is easy to lie to yourself about practicing and spend time without actually doing meaningful practice.
- From the outside it is impossible to tell the difference: no one can look at your practice and tell you for sure that you are deceiving yourself.
The second point is why it is fruitless to write blogs of the type "why am I not improving". No one can see inside you.
The point
According to my latest hunch, self-deception is the single biggest cause of not improving. I want to boldly put forward three hypotheses:
- The best practice method is any reasonable method that doesn't let you deceive yourself.
- If you are sufficiently motivated, almost anything satisfies the criterion above.
- If you are not motivated, then almost nothing satisfies the criterion above.
By "motivation", I have a specific meaning in mind. The only motivation that matters here is a deep interest in the problems themselves. For a lot of people the motivation is that if they do well, they have a better chance of getting a job (I don't know if it is true or not, but there are a lot of people that do CP for this reason). A relatively small number of people even get a stipend or similar for CP. That kind of motivation can serve as a kind of secondary motivation in the sense that it gives you a reason to do CP instead of something else, but it's not enough. If you just watched a video from Steve Jobs or Elon Musk with a bunch of genericisms about success or read some motivational poster and got some kind of inspiration — I don't think that will get you very far. Interest in the problems is what matters here.
Are editorials evil?
I want to discuss certain cases where I suspect something very similar is happening. A popular method of practice is the following:
Pick a problem with difficulty rating $$$f(\text{your rating})$$$ and start solving it. If you haven't solved it after $$$n$$$ minutes (or $$$n$$$ minutes with no ideas), read the editorial.
In principle, I think that is a reasonable way to train. Here's what I think will really happen with a lot of people.
Pick a problem with difficulty rating $$$f(\text{your rating})$$$. Pretend to solve it for $$$n$$$ minutes, then read the editorial.
A quick note about terminology: at least in this blog, "solve" means "come up with the solution (and possibly, implement it)", not "implement the solution". I believe most users will use the terms this way, but I have seen newbies take it the other way and get some wrong ideas about suggestions.
Here, "pretend" can have a variety of meanings. Mostly it means a few half-assed attempts at solving the problem, maybe even trying a few common approaches but never fully devoting yourself to the problem because soon, you will see the editorial anyway. I know this happens, I have seen it happen to people and it has even happened to me.
Let me make a radical suggestion. Forget editorials. Start solving problems with no intention to ever read the editorial. Stop asking "how many minutes" and start asking "should I read the editorial at all?": not "when" but "if". I learned much of my early competitive programming on the USACO training pages. Even though it is quite dated now, I can still recommend that website. I attribute my pretty much immediate blue rating and some other early success to that site. There, you have no option of reading the editorial and that forces you to solve the problem until the end. Yes, a couple of times I searched for a solution, but only as an emergency. Do not make it a regular thing.
When this has been suggested in Codeforces comments, the most common reply is along the lines of
But if I don't read editorials, how will I learn new techniques?
Here's a list of techniques you need to know to get out of grey: DFS, binary search and ideas taught in middle school math. I actually think that list is exaggerated and it is possible to remove two or three things from this list, but let it be for the moment. I suspect that you might be seeing some statements in editorials that kind of look like techniques you're supposed to learn.
An example from a recent contest: the solution to 1617C - Paprika and Permutation mentions this fact: $$$x \, \mathrm{mod} \, y < \frac{x}{2}$$$ or $$$x \, \mathrm{mod} \, y = x$$$.
However, I'll say something different. These aren't techniques you're supposed to learn. You are actually meant to be able to come up with these during the contest. If it seems impossible for you to do, then it might be because you are depriving yourself from the part of practice that teaches you to think. If you go deep into every problem, you might see yourself being able to come up with that stuff faster and faster.
Yes, some of the facts I mentioned have appeared in several problems, so if such ideas come up again you're able to solve faster. But if you come up with them yourself when you need them the first time, you will know them the next time anyway. And the probability of retaining a fact is far greater if you come up with it yourself.
Update 06.01.22. Based on the comments I want to clarify this a bit. No, I'm not saying that this is the only correct way to practice. And I don't claim that editorials are actually evil or that you're not meant to actually read them — they are in fact made to be read. The title and content of this section is provocative by design, but the suggestion is serious. Try it, try it more than just once. You may discover that coming up with ideas is far more possible than you perhaps think.
Biased selection of problems
This is the second big thing.
Suppose you have a list of problems. For example, you went to the Codeforces problemset page and filtered it to show problems that have difficulty rating $$$f(\text{your rating})$$$ and/or problems that have tags in some topic you want to improve in. What will you solve?
Here's what often happens. You pick some problems and start working on them. The ones that are easier to you you will solve. The ones that you don't immediately solve you just kind of... leave be. Or maybe you used some kind of problem recommender and rerolled it multiple times, making up dubious excuses to justify skipping the problem, until you reached a problem that was kind of easy for you.
Some of you are wondering why you are still green after solving 100 problems with difficulty, let's say, 1600. But can you honestly say that this is a random sample of 100 problems with this difficulty? Or are these 100 problems in fact heavily biased towards the things you already know? Or does it mostly contain problems that are actually way easier than 1600 but have this rating because of some quirk in the difficulty rating system (for example, I don't trust the ratings of hard problems from Div. 2 and Div. 3 only contests)? Hard to tell, but in many cases it's hard to believe that they are uniformly distributed.
What's the solution here? Remember, the best practice method is any reasonable method that doesn't let you deceive yourself. USACO training solved this problem like 25 years ago (I'm guessing based on the appearance of the website): you can only see a small number of problems at a time. You HAVE to solve every problem to advance. There used to be another site. A2OJ ladders, the ones that were based on the position in the contest (like "Div.1 D") used to only show one problem. Sadly, they don't seem to do it any more. This is the feature that made A2OJ great, not that they had a list of problems to solve. Keep this in mind if someone suggests A2OJ ladders to you.
In a way these two ideas relate to Goodhart's law. How many problems you have solved is an ok measure for how much effort you have put in, but if it becomes your goal, then you are by human nature likely to solve a lot of problems in the easiest way possible which of course defeats the purpose of practicing.
These are the two main things I wanted to talk about. There are more examples of self-deception. In order to not dilute the blog post with too many other points, I decided to post more examples in the comments, look for them below. These are a bit more controversial, so your mileage may vary.