Dear Codeforces community.
According to IOI 2019 Results, I got the 25th place and got successful gold medals twice in a row.
Although it was pretty close to the gold-medal border (only 6.14pts / 600 difference) and it was lower performance than IOI 2018, which I participated when I was orange in Codeforces, I had many chances to get more points in this IOI, even for top 10. Since there are not so many people who have got two gold medals in IOI (and there were many requests like "I want E869120 to talk about how to get gold in IOI" like this comment and this comment). I want to write something about IOI, which may be useful for people who will participate in IOI next year and also some years later.
A. First of all
At first, I want to write some premise to avoid comments like "I hate this post because I have no ties to IOI at all", or "How can I get gold with a 10-day practice from gray coder?". This blog is for people who want to improve skills in IOI (or national selection camp), and also for people who want to teach people practicing for IOI. But, even if you are not familiar with IOI, you may gain benefit by reading this post, because there is a little correlation between IOI and Codeforces. :)
So, let's move on to the main subject.
I think that the minimum requirement needed to be a gold/silver medalist is as follows:
- Know famous algorithms like segment tree, union find, set, map, sqrt decomposition, Convex Hull Trick, suffix array, Dijkstra method, minimum spanning tree, Euler tour of a tree, divide and conquer, binary search, etc. Are there any algorithms that you have not yet understood among I stated above? If there are, please check and understand the algorithms.
- Have skills equivalent to rating 2200+ (for silver I think it is 1800+) in Codeforces. Even if you know a lot of algorithms, if you have no skills to think algorithms and implementation, you cannot solve a problem like Shoes, or 40pts of split. If you want to gain Codeforces / competitive programming skills, let's read another post.
- Understand how to solve interactive problems and output-only problems. If you are not familiar with interactive / output only problems, you should see past problems.
- Be good at speed-solving. To get many subtasks or partial scores, fast implementation is needed. I will write about how to improve speed-solving skills which are useful in IOI in this blog.
- Have a good strategy. I think that strategy is the most important part of IOI. I will write about an example of a good strategy in this blog.
- Be able to sustain maximum concentration and performance for 5 hours. I will write about a way to improve concentration by practicing in this blog.
- Be mentally strong and don't give up your hope from the first second of the contest to the last second of the contest no matter what happens. I will write about my way to get an unbeatable mind that can fight in IOI in this blog.
B. My concept about IOI
Some people said that "What is important for IOI is to gain skills to solve difficult problems by thinking long hours" in this comment. Yes, it is important for me, who aims top5 or top1 in IOI next year, or in some contest which there are not so many subtasks like Japanese national team selection camp. But I think that it's a bit different for people whose goal is "silver" or "gold" in IOI.
Solve all the subtasks that you can gain with your skills within 5 hours is very important. Some people think like "5 hours? Too long. It is 2.5x longer than normal Codeforces round! I'm sure that I can solve all the subtasks that I can gain". But it's not as easy as it sounds — because IOI has a lot of subtasks, mainly they are implementation-heavy. For example, problem vision has 8 subtasks! For a problem which has many subtasks, if you have a strategy like "First, implement the solution of $$$N \leq 300$$$ which I can find the solution within a minute. Second, think 10 minutes for the next subtask and implement the solution for $$$N \leq 5 \ 000$$$. Third, think 10 more minutes and solve in a special case for $$$A_i \leq 10$$$. Fourth, think the solution of the full score, which the constraint is $$$N \leq 100 \ 000$$$.", you have no time get all implementation done if you have no skills of speed-solving!
So, let's see statistics to see how much "not losing points" and "speed-solving" are important for IOI. Think about two cases down below.
(i) Suppose you solved all the subtasks which 110 or more people got in each year's IOI
|Year||Day1 P1||Day1 P2||Day1 P3||Day2 P1||Day2 P2||Day2 P3||Total Score||Final Rank||Medal|
|IOI 2019||100||40||50||53||66||24||333||77/327||Silver :)|
|IOI 2018||100||17||49||53||12||36||267||87/335||5 pts to Silver|
|IOI 2017||31||20||11||90||13||50||215||102/304||34 pts to Silver|
|IOI 2016||100||34||23||90||38||16||301||94/308||27 pts to Silver|
(ii) Suppose you solved all the subtasks which 45 or more people got in each year's IOI
|Year||Day1 P1||Day1 P2||Day1 P3||Day2 P1||Day2 P2||Day2 P3||Total Score||Final Rank||Medal|
|IOI 2019||100||40||72||71||100||24||407||31/327||7 pts to Gold|
|IOI 2018||100||37||49||86||51||36||359||19/335||Gold :)|
|IOI 2017||83||100||27||97||51||50||408||10/304||Gold :)|
|IOI 2016||100||34||31||100||100||60||425||22/308||Gold :)|
So, how difficult is the subtask which can be solved by 110 people, or 45 people?
My opinion is this:
- 110 people: Same as Codeforces difficulty 2100. If you are purple, you should solve within ~70 minutes. If you are orange, you should solve within ~40 minutes (since for many problems in IOI, implementation is heavy)
- 45 people: Same as Codeforces difficulty 2600. If you are blue, almost impossible to solve. If you are orange, you should solve within ~2 hours. If you are red, you should solve within ~1.3 hours.
In conclusion, I think that not losing a point and speed-solving are very important parts of IOI, for people who aim to get a silver or gold medal.
C. How to practice speed solving?
As I stated above, I think that practicing speed-solving is a very important part of IOI. So how can you improve speed-solving?
If you think that you take too much time to solve Codeforces Div2 A, B or C problems (e.g. 4 minutes for Div2A, 8 minutes for Div2B, 15 minutes for Div2C if you are orange. ~1.5x for purple, ~2x for blue.), you should solve AtCoder Beginner Contest problems. My recommendation to gain fundamental skills is to solve 300pts or 400pts problems in AtCoder. Since AtCoder has many problems, you can practice a lot. I also think that doing a virtual contest is also important. That's because virtual contest makes you concentrate. When I was 8th grader, I made a virtual contest, which I selected ~5 problems from AtCoder whose difficulties are 300-400pts and tried to solve them within ~1 hour.
Practicing Speed Solving for IOI
I think that you can do two things to practice speed solving for IOI.
- One is doing a virtual contest or IOI-like contest. If you do one or two virtual contests, you may realize how important speed solving is. (If you don't, you should read about my strategy of IOI, which led me to the stable acquisition of gold medals. Then, let's do one more virtual IOI-like contest with using my strategy.) There are a lot of IOI-like contests, for example, International Olympiad in Informatics (IOI), Japanese Olympiad in Informatics (JOI), Central European Olympiad in Informatics (CEOI), Baltic Olympiad in Informatics (BOI), info(1) cup, etc. So, you can do many IOI-like contests. I recommend doing this one at first.
- Another one is solving ICPC problems with a clock/timer. Since many ICPC-problems are implementation-heavy and also most of the problems require some algorithms (≅ not ad-hoc problems) to solve them, you can also gain speed-solving skills which are vital for IOI. Unfortunately, most of the problems in the ICPC World Finals are very difficult. So, you can solve problems for regional contests or national qualification round. But how can you find the problems? For example, AIZU ONLINE JUDGE has a lot of ICPC problems. Also, if you want to practice speed-solving in AIZU ONLINE JUDGE, solving problem from PC Koshien (PCK) is a good idea. Both for ICPC and PCK, if you have no time to solve all of them, I recommend solving new one. If you did virtual contests of most of the IOI-like contest, or if you solved many IOI-like problems, it may be a good idea to do this.
- If you want to get a gold/silver medal in IOI, you should do virtual contests of at least 5 recent years of IOI. With virtual contests, you can gain not only speed-solving skills that you can solve many subtasks within a short time but also your strategy of IOI.
D. My strategy of IOI
Firstly, my strategy is for people who have high-level skills in speed-solving. If you are not good at speed-solving and want to follow my strategy, you should read the previous section: "How to practice speed-solving?".
In addition, my strategy will not work for people who want to aim absolute winner. I think that getting absolute winner in IOI needs to take much risks.
I will explain in two parts: "base strategy" and "additional strategy".
Base strategy of IOI 2018
(i) First 1/2 of the contest
In the first half, I use ~50 minutes for each problem. For example, from 0:00 to 0:50, solve Problem 1. Then from 0:50 to 1:40, solve Problem 2. Finally, from 1:40 to 2:30, solve problem 3. For each problem, I did a strategy like this:
- Read problem for 2 minutes.
- Think of the solution for 3 minutes.
- Implement the solution and get all subtasks which I find the solution within 3 minutes. For me, the implementation takes 5-20 minutes.
- Think of the solution for 10 more minutes.
- If I could not find any better solutions, give up this problem and move on to the next problem. If I could find a better solution, implement it. If the implementation is heavy, it takes more than 50 minutes in total of this process. In this case, the duration that I can put on the second part will be reduced.
(ii) Second 1/2 of the contest
I try to find the easier subtasks among remaining and solve (or give up) them. Though it depends on how much time is remaining and the number of remaining problems, usually when I think for 50-60 minutes and cannot reach any of the solutions, I will give up the problem and choose another one. But how do I find the easier subtasks? The hint is on the scoring:
- Mainly, if the scoring is very rough (e.g. Subtask #1: 5pts, Subtask #2: 10pts, Subtask #3: 35pts, Subtask #4: 50pts), the problem (full solution) is easy. It is true for IOI 2018 Combo, IOI 2015 Boxes with Souvenirs, IOI 2019 Shoes. Their subtasks’ scores are mostly multiple of 5. Conversely, if the scoring is not very rough, the problem is not so easy.
- If the score of the last subtask is big (e.g. 40pts or more), the full solution of this task is usually very difficult. Though problem IOI 2017 Wiring is not so difficult while the last subtask is big, most of the problems whose last subtask’s score is big tend to be difficult in IOI. There are some examples: IOI 2019 Split, IOI 2019 Walk, IOI 2018 Meetings, IOI 2017 Toy Train.
- If the scoring of the first subtask is low and relatively difficult, the full solution is likely to be difficult. For example, if the first subtask can be solved by just using if-statement and you can get 10pts, this problem is likely to be easy. Conversely, if the first subtask requires writing 100+ lines brute force and you get only 7pts, that problem is likely to be difficult. For example, IOI 2019 Walk is a difficult-case example. But this is just a tendency and not always true — for example, in problem IOI 2015 Towns, though only 111 out of 321 people got positive scores, this problem is not too difficult — 7 people solved it.
By the way, I used a bit different strategy for IOI 2019. That's because there were some issues like these:
- In Day1, in problem rectangle, the sample input in official zip file was wrong. (It was fixed after ~1 hour after the contest starts)
- In Day1, from ~0:55 to ~1:05 (from the beginning of the contest), we could not be able to access to the judge server. (504 gateway timeout)
- In Day2, we could not download zip file because of the initial setting of PC (zip file was downloaded to root directory, where the contestant didn’t have access to), so I could not use PC for the first 15 minutes (after I raised my hand and called a staff, the problem on my PC was fixed)
- Since most of the contestant (I think all) suffered from the previous problem, 40 minutes after the contest starts, all contestants’ PCs were restarted.
Since I could not gain many scores in the first 1 hour because of the issue, I changed the strategy a bit:
- For the first 80 minutes, I got some subtasks of the problem which I thought the full solution was the most difficult. (In Day1, since I felt that split was easier than rectangle then, I attempted rectangle at first)
- For the next 20 minutes, I solved some subtasks which were obvious, for the problem which I thought the full solution was the easiest.
- Next, since I thought that getting at least one 100pts for each day was the key to winning a gold medal, I solved the easiest problem. (For day1 it took 60 minutes, and for day2 it took 95 minutes)
- After getting 100pts, I got some subtasks of the remaining problem for 50 minutes. (For day2, since remaining time was already short, I used the all remaining time to solve output only task.)
- If I had remaining time, I used the same strategy as IOI 2018 in the second half of the contest.
On day2, there was an output only task. When I got 57pts of Problem 3 (walk), I had two choices: "Get 66pts on Problem 2 (vision) instead of getting 100, and get better score in output only task", or "Get 100pts on problem 2 (vision), and get lower score in output only task". I chose the second one because I thought that the key to winning was to get 100pts on problem vision. So, for each day, it’s important to ask yourself “what is the key to getting a gold medal?” in a critical moment.
Also, if you can estimate the border of gold, it is better. I think that you will be able to estimate the border of gold/silver if you solved past 5+ years IOI problems.
E. Results of strategy
In IOI 2019, I finally got the gold medal. But there is an interesting fact — in Day2, when just 2 minutes before the contest ends, I was in the silver-medal zone. My source code of output only bugged, while time is running out. In the contest duration 5:13:50 — I finished the debugging at 5:12:10, I submitted at 5:12:28 and 5:13:24, these submissions brought me to the gold medal. Unfortunately, I could not submit two more testcases. If I had time to submit them, my score might be 61pts. I also had an idea to get 85+ points in output-only tasks, so if I had time to implement it, I might have a chance to get ~10th place in IOI. But fortunately, I won a gold medal.
So, how I sustained my concentration for the whole 5 hours? How my mind was able to endure the last 5 minutes of IOI 2019? There is an effective way to gain concentration and mental toughness. I will explain in the next section.
F. How I succeeded to gain concentration and mental toughness
In IOI 2019, I got gold because of the last few seconds. But this action needs a lot of concentration and strong minds because it was one of the life-changing matches for me. Why did I succeed to gain such skills? Here is my way.
- Do 10-hours virtual contest many times. It means double IOI. For example, choose six difficult IOI-like problems and get as many points as possible in 10 hours. Also, choose two-days IOI-like competition (e.g. CEOI) and solve them including day1 and day2 within 10 hours is OK. I did this kind of virtual contest for 4-5 times before IOI. If you do 10-hours virtual contest many times, you will get used to concentrating in long-hours contests. If you can concentrate in the 10-hours contest, it is sure that you can concentrate for 5 hours!
- Know your limit and challenge to break your limit. One of the easiest ways to break your limit is real-marathon (running long distance) — because a lot of physical skills and mental skills are needed. For example, a week before a big competition (IOI or JOI selection camp), I run for ~20km as hard as I can. In the competition, I can think that "since nothing is harder than that running or real-marathon, I can do anything in IOI". Also, another advantage of running long distance before a big competition is that I can gain more physical strengths. Because 5 hours is long, if you have more physical strengths (especially endurance), there could be some advantage for you in IOI.
At first, I have to apologize for one thing — sorry for my poor English. If you have some trouble understanding my English, please write a comment and I will fix it. Thank you for your patience.
Lastly, I want to write some advice for challengers in Codeforces, based on my experience in IOI 2019.
- Firstly, In International Olympiad in Informatics (IOI), some troubles may occur. It may be major problems like we cannot download the files. In Codeforces the round can be unrated, but in IOI the round cannot be unrated. So, your flexibility — ability to respond to the situation flexibly is important in IOI.
- Secondly, in IOI and Codeforces, all seconds during competition have the same value. In the example of IOI, you have 5 hours. But the value of first 1 second in the contest, the value of 1 second just after 1 hour and 49 minutes has passed from the start of the contest, and the value of the last 1 second of the contest, are all the same. So, what is important is — don't waste even a single second in the contest. A person who makes light of a second loses. If you value every second during the contest and do everything you can during the limited time, you will win.
- Lastly, though IOI competition lasts 10 hours including day1 and day2, it was at last 2 minutes I found the final bug, at last 82 seconds of the competition I entered the gold-medal zone, and at last 26 seconds of the competition, I made sure to get a gold medal. Sometimes this kind of things happen. The competition results will not be determined until the last minutes, the last second, and even the last 0.1 second. The person who never gives up until the last moment will win.
If you have some suggestions & comments & opinion & your strategy, please comment on my blog!
Thank you for reading!!!