原文发布于 Codeforces 的博客上,作者 Um_nik。link
因觉讲得极好,故抄录一份于此。也许教练们都应该看看这篇文章。
原文有色彩渲染,然而暂不知如何做到,故用粗体代替。
CP is about solving problems fast. And as absurd as it may sound, I believe that SOLVE and FAST are very different and almost independent parts, and you need to practice them separately.
Let’s look at some contest, like a CodeForces round. For the sake of simplicity let’s assume that every problem has some difficulty, which is a numerical value denoting how hard it is, bigger values correspond to harder problems (it is not true, but it is an ok-ish approximation, at least if we consider subjective difficulty for a fixed person). Contests are made for a wide range of participants, and problemsetters strive to make contests interesting for a wide range of participants, which means having a smooth difficulty gradient. Well… as smooth as it is possible with 5-6 problems.
On the moment of a contest you have some ability to solve problems. If we assign each problem with numeric difficulty, it is reasonable to say that your problem solving ability is also a number on the same scale. But it doesn’t mean that you can solve all the problems below your level and can’t solve anything above your level… it’s more like “probability distribution”, or maybe how much time you need to solve the problem of given difficulty:
The issue is this probability distribution is something close to sigmoid: You can surely solve the problems that are much lower than your level and you solve them almost instantly after reading; on the other hand, you need too much time, maybe even infinite time, to solve problems way above your level. And that interval of difficulties which is not too easy while not too hard for you is rather small. Let’s call this interval interesting.
Since one contest has only a few problems and should cover a wide range of difficulties, there is usually one problem in your interesting interval, rarely there are two, sometimes there are none. These are the situations to which some participants refer to as speedforces: your result in the contest depends on how fast you solve easy problems. I don’t want to disappoint you, but almost every contest is a speedforces contest in a sense that your result is mostly determined by your speed and accuracy on easy for you problems or, how I call them, problems that you already know how to solve. In a contest, you don’t have time to come up with something completely new and original. Yes, you need to get what is the problem about, unravel some layers of reductions and implement the solution, but in a nutshell you know how to do every small part of the problems you will solve in the contest before the contest even starts.
What I’m trying to convey is that in a contest your goal is to solve the problem that you already know how to solve fast. By doing X you learn how to do X, so by participating in contests you learn how to solve problems fast. But then where do you learn how to solve problems?
To learn how to solve problems you need to solve problems, solve problems that you don’t yet know how to solve, but that are possible for you to come up with, maybe using a lot of time. These are the problems from the interesting interval, slightly above (or below in some cases) your current level, but not too much above because otherwise you can’t solve them yet. So we need to somehow find a lot of problems near your level, how to do that? The answer is rather simple: go to a place that has a lot of problems of various difficulties and doesn’t have a time limit. It is not a contest, it is an archive.
Just by having a lot of problems archives can almost always provide a problem of needed difficulty. And you don’t really need to do anything special to achieve that: sort the problems in the archive by difficulty and solve them. After the first period when the problems are too easy for you you will always be at a level where the next problems are the right difficulty for you because after solving a hundred problems your level will rise a bit, but so will the difficulty of the next problems.
I notice that nowadays many people start from CodeForces contests, and I think it is bad and it is the underlying reason for many frustrations. Some things that come to my mind:
- Newbies are ok with repeating problems in contests, problemsetters shouldn’t be so worried about problems being fresh — you should solve old problems in archives, learn classic techniques there and then use them in contests, contest problems need to be fresh.
- Where will we learn stuff if in contests there are no problems on classical techniques — again, learn the techniques themselves in archives, then you will see that there actually are problems that use classical techniques in contests, and obviously, there should be no problems that just are classical in contests.
- It is hard to make a training regime out of contests — it is, and you shouldn’t do this, contests should be only a part of training regime.
- Contests allow that self-deception thing: you can solve a lot of problems in contests, but they are the problems you already know how to solve and that doesn’t increase your level.
The questions that I anticipate (ask your questions in the comments if needed):
Q: How long do I try to solve the problem in the archive before reading the editorial? Like, 30 minutes?
A: You don’t read the editorial. The best option is to choose an archive that doesn’t have editorials at all, so you don’t have to fight the urge to look at the solution.
Q: Ugh, and what should I do if I can’t solve the problem?
A: Abandon it, for now, switch to a different problem, return to it after a month or so. My usual approach was to open 10-15 problems, read them carefully, think a bit, choose the one I want to try and solve now, try for some time. If I don’t feel like I’m getting anywhere, switch to another problem.
Q: Month?!
A: Maybe even more. You need time to acquire new skills and discover new ways to look at this problem (by solving other problems). It doesn’t make sense to return in less than a month because you will only run through the same ideas you did before.
Q: Ok, but how do I learn new techniques if I don’t read editorials? I’m not supposed to invent everything on my own, am I?
A: Most of the time you don’t need to learn any advanced stuff to solve the problem, you can’t solve it because you are not trying hard enough or not paying attention to details or just being stupid. My experience even says that most Russian schoolchildren who do CP know too many algorithms.
Q: But there are problems that require some standard things!
A: OK, yes. The best option, in my opinion, is to have some person around who solves the same archive and is better than you. In case you are stuck on a problem for a long time (that’s not an hour, that’s several months) you should ask them “Do I have to know some standard technique to solve this?” Pay attention: not ask how to solve, or for a hint, just a yes/no question. Most of the time the answer will be “No”. In the case of a positive answer, they will be able to send you a link to an article or what to google to learn about the technique. After that, you still will have to apply this technique to the problem, and you are more likely to actually remember how to use it and why did you need it in the first place, which tremendously increases your chances to use it successfully in the future.
Q: OK, which archive should I use?
A: It is not that important, but you should use one and stick to it. I have used Timus because I’m from Ural region, there are numerous others: UVa, SPOJ, Codeforces archive (has editorials and too many problems, thus a warning) etc.
To sum it up:
In archives you learn how to solve problems, in contests you learn how to do it fast. I’m not saying that contests are not needed: speed is also very important, and it is good to keep you in competitive shape. Also participating in contests is just fun, that’s also very important.
Acknowledging this and separating learning how to solve from contests can lead to better training, I believe.
How to split the time between archives and contests? Well, contests are held in some fixed time, so when there is a contest that fits into your schedule, you shouldn’t miss it. Turn to archive when you want to practice and solve something which should be often, otherwise CP is probably not for you.
机翻+轻微手改:
算法竞赛是关于快速解决题目。虽然听起来很荒谬,但我相信 SOLVE 和 FAST 是非常不同的,几乎是独立的部分,你需要分别练习它们。
让我们来看看一些比赛,比如 CodeForces 比赛。为了简单起见,让我们假设每个题目都有一些难度,这是一个数值,表示它的难度,更大的值对应于更难的题目(这不是准确的,但这是一个不错的近似值,至少如果我们考虑到一个固定的人的主观难度)。比赛是为广泛的参与者而设计的,题目制定者努力使比赛对广泛的参与者来说有趣,这意味着要有一个平滑的难度梯度。嗯…5-6 个题目,尽可能流畅。
在比赛的那一刻,你有一些解决题目的能力。如果我们用数字难度来分配每个题目,那么你解决题目的能力也是一个数字,这是合理的。但这并不意味着你可以解决所有低于你水平的题目,而不能解决高于你水平的题目……这更像是“概率分布”,或者你需要多少时间来解决给定难度的题目:
问题是这种概率分布接近于 s 型曲线:你当然可以解决比你的水平低得多的题目,而且你几乎可以在阅读后立即解决它们;另一方面,你需要太多的时间,甚至是无限的时间,来解决远远超出你水平的题目。对你来说既不太容易也不太难的困难间隔是相当小的。我们称这个区间为有趣区间。
由于一场比赛只有几个题目,而且应该涵盖广泛的困难范围,所以在你的有趣区间通常有一个题目,很少有两个题目,有时没有题目。这些情况被一些选手称为速度力:你在比赛中的成绩取决于你解决简单题目的速度。我不想让你们失望,但几乎每一场比赛都是一场速度力的比赛,从某种意义上说,你的结果主要取决于你对简单题目的速度和准确性,或者我称呼它们,你已经知道如何解决的题目。在比赛中,你没有时间想出一些全新的、原创的东西。是的,你需要弄清楚题目是什么,解开一些层次的缩减并执行解决方案,但简而言之,你甚至在比赛开始之前就知道如何解决题目的每一个小部分。
我想表达的是,在比赛中,你的目标是解决你已经知道如何快速解决的题目。通过做 X,你学会了如何做 X,所以通过参加比赛,你学会了如何快速解决题目。但是你从哪里学习如何解决题目呢?
为了学习如何解决题目,你需要解决题目,解决你还不知道如何解决的题目,但你可能会想到,可能会花很多时间。这些是来自有趣区间的题目,略高于(或低于)你当前的水平,但不会高出太多,否则你还无法解决它们。所以我们需要在你的水平附近找到很多题目,怎么做呢?答案很简单:去一个题目多、困难多、没有时间限制的地方。这不是比赛,这是题库。
由于有很多题目,题库几乎总是可以提供一个有难度的题目。您实际上不需要做任何特别的事情来实现这一点:按难度对题库中的题目进行排序并解决它们。在第一个阶段,当题目对你来说太简单的时候,你总是会达到下一个题目对你来说是合适的难度的水平,因为在解决了 100 个题目之后,你的水平会上升一点,但下一个题目的难度也会上升。
我注意到现在很多人都是从 CodeForces 竞赛开始的,我认为这很糟糕,这是许多挫折的潜在原因。我想到了一些事情:
-
新手可以接受比赛中重复出现的题目,题目制定者不应该太担心题目是否新鲜——你应该在题库中解决老题目,在那里学习经典技术,然后在比赛中使用它们,比赛题目需要新鲜。
-
如果在比赛中没有经典技术的题目,我们将从哪里学到东西,再一次,在题库中学习技术本身,然后你会发现在比赛中使用经典技术实际上是有问题的,显然,在比赛中不应该有仅仅是经典的题目。
-
从比赛中制定一个训练计划是很困难的,你不应该这样做,比赛应该只是训练计划的一部分。
-
比赛允许自我欺骗:你可以在比赛中解决很多题目,但它们是你已经知道如何解决的题目,这不会提高你的水平。
我预期的问题(如果需要,请在评论中提问):
问:在阅读题解之前,我需要多长时间尝试解决题库中的题目?大概30分钟?
A:你不要看题解。最好的选择是选择一个根本没有题解的题库,这样您就不必与查看解决方案的冲动作斗争。
问:呃,如果我解决不了这个题目,我该怎么办?
答:暂时放弃它,换一个不同的题目,大约一个月后再回来。我通常的方法是打开 10-15 个题目,仔细阅读,思考一下,选择一个我现在想要尝试解决的题目,尝试一段时间。如果我觉得没有任何进展,就换一个题目。
问:月? !
A:也许更多。你需要时间来获得新的技能和发现新的方法来看待这个题目(通过解决其他题目)。在不到一个月的时间内返回是没有意义的,因为你只会重复你以前做过的想法。
问:好吧,但如果我不读题解,我怎么学习新技术呢?我不应该一个人发明一切,对吧?
答:大多数时候,你不需要学习任何高级的东西来解决题目,你解决不了题目,因为你不够努力,或者不注意细节,或者只是愚蠢。我的经验甚至告诉我,大多数学算法竞赛的俄罗斯小学生知道的算法太多了。
Q:但是有些题目需要一些标准的东西!
A:好的,是的。在我看来,最好的选择是找一个比你更优秀的人来解决同样的题目。如果你被一个题目困了很长时间(不是一个小时,而是几个月),你应该问他们:“我必须知道一些标准的技术来解决这个题目吗?”注意:不要问如何解决,或者作为提示,只用一个是/否的问题。大多数时候答案是“不”。如果你的回答是肯定的,他们会给你发一个文章的链接,或者在谷歌上学习这个技术。在那之后,你仍然需要将这个技术应用到题目中,你更有可能记住如何使用它以及为什么你首先需要它,这极大地增加了你将来成功使用它的机会。
问:好的,我应该使用哪个题库?
A:这并不是那么重要,但是你应该用一个并且坚持下去。我使用Timus是因为我来自乌拉尔地区,还有许多其他的:UVa, SPOJ, Codeforces 题库(有题解和太多的题目,因此一个警告)等。
总结一下:
在题库中,你学会如何解决题目;在比赛中,你学会如何快速完成任务。我并不是说不需要比赛:速度也很重要,它能让你保持竞技状态。参加比赛也很有趣,这也很重要。
我相信,认识到这一点,将学习如何解决题目与比赛分开,可以带来更好的训练。
如何在题库和比赛之间分配时间?嗯,比赛是在固定的时间举行的,所以当有一个比赛符合你的时间表时,你不应该错过它。当您想要练习和解决应该经常解决的题目时,请转向题库,否则算法竞赛可能不适合您。


