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 :) |

**all you need**.

**Note that the task order is the same as the IOI official results page for each year. (example) Also, since I could not get any information about what subtask did each person get, "the score when you got all the subtask which solved by 110+ people" is calculated as the 110th score for each problem. Same for the 45th.**

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?

**Basis**

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.

**Additional strategy**

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.

### G. Conclusion

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!!!

All of the links are broken

Sorry for this issue, but it's not my problem. It's problem on Codeforces.

UPD: It's my problem. Thank you for jonathanirvings.UPD 2: The links are fixed.Try full absolute address (i.e. http://stats.ioinformatics.org/results/2019)

Thanks a lot. I think that all links are fixed. :)

For me my strategy is pretty different I think lol. I tend to aim for as many full solves (or close to full solves) as possible, and only scrap subtasks when I think I don't have enough time (or when the subtasks look like the key to the solution, but sometimes I won't implement it yet even if I got the idea). I'm not sure if this is a good strategy if you're just looking for getting gold at IOI (as you said, getting all the relatively easy tasks/subtasks is sufficient).

I agree that being able to solve subtasks quickly is important to get gold in IOI unless you're confident you can AC everything lol. Sometimes the AC solutions aren't that hard though, and with some luck you might be able to come up with it, and so I'd suggest instead of coding subtasks immediately think more on the problem first and see how far you can potentially go. Make sure to keep track of your time however and give yourself a hard time limit and start scraping subtasks after that time limit (which you're confident that you can code the subtasks in). I'm probably not a very good example though since I always ended up having not enough time to code the trivial subtasks XD (e.g. even in IOI 2018 I failed 37 pts on seats, 36 points on meeting and screwed up on machine dolls lol).

If your goal is to improve your problem solving skills in general though, solving harder problems than what you're comfortable with is the only way I think.

Thanks for sharing your experience !

I always wondered how close CF and IOI were to each other. many of my friends say that they require very different skills, although i think that if you are not aiming for top 15-20 then CF and IOI are almost the same.

Can anyone find the number of inversions of IOI rank w.r.t to CF rating, and also the avg. number of inversions in a CF round w.r.t to CF rating. Also maybe try to do this with current CF rating and max CF rating to see how much diff that makes.

I think skills on all platforms are similar, because problem solving skills is the most important thing, independently of the type of the contest.

IMO speed of solving problems is more important than problem-solving skills when participating in a CF round. But in IOI that's not true. CF is more similar to ICPC instead of IOI.

Maybe, but for example, AtCoder is similar to IOI.

https://codeforces.com/blog/entry/69085

And there was another blog about this, can't find it

what are your favourite japanese competitive programming sites? (online judges, etc)

When is your goal changed from "getting the 10th place... I mean the 1st place for my brother who didn't make to the national team" (which you answered in the national team announcement) to "just getting a gold medal"?

Some (not so helpful) comments:

"I think that strategy is the most important part of IOI."

My strategy is similar to zscoder's, except I don't keep very good track of time. :| Honestly, as long as your strategy isn't something terrible like "only submit when you think you have 100 pts" I think you'll be fine?

"Do 10-hours virtual contest many times. It means double IOI."

I don't do this (doesn't seem like a very fun idea ...). In fact, I rarely do 5-hour virtual contests.

"40 minutes after the contest starts, all contestants’ PCs were restarted."

Lost access to my solution to vision at this point and had to redo from scratch :|

"In Day1, since I felt that split was easier than rectangle then, I attempted rectangle at first"

For me, Split was easier than Rectangle. I assumed that there would be a natural extension from the tree case to a general graph, and that turned out to be correct!

"The competition results will not be determined until the last minutes, the last second, and even the last 0.1 second. "

In the last few minutes I managed to gain 1/6'th of a point on Line, which finally put me over 90 points (went from $$$N+4$$$ to $$$N+3$$$ on one test case). I still ended up less than 1/6'th of a point behind 300iq, which would have been quite sad if he had had 300 pts on day 1 ...

I think strategy differs according to the goal. When you can't fully solve a problem in a day, you need to adapt your strategy because you have three problems each one needs investigation, implementation, etc... However, someone in your level could almost always eliminate a problem, which makes a strong strategy sometimes unnededed.

69 upvotes... Nice

Wow how many hours do u sleep a day to be able to practise that hard E869120?

Around 7 hours per day. This is an example of my schedule (weekends) around 2 month before IOI.

This is an example of contest-based days. There are also some review-based days. In review-based day, I will review some of virtual contest that I did before.

For real? How didn't you win all contests you participate with such schedule if you actually do that for most of the time for 2 months. Also where do you take so many contests and when do you have time to upsolve everything. Sorry if it is present in a post, didn't read it.

Simply because I am not genius.

Where do u find so many OI style virtual contests though?

I can find it here. Pretty tough to solve everything here in only 120 virtuals, though.

Wow, what the fuck. Congratulations on your well-deserved gold medal. I don't like your strategy. But from this, it's obvious that you deserve it.

Me:

does a single IOI-like virtual contestMe: What a productive day!

I couldn't understand one thing,don't you go to school?When you pass the national eliminations,does the Japanese education system give you privileges?How did you have time to train for IOI like 14 hours daily when you are a high school student? E869120

I went to school. I think that I forgot to write one thing — on weekdays (Monday — Friday) I practiced 7-7.5 hours on average.

People should follow strategy from this post ;p the one described in the blog isn't that important.

I think this post shows why strategy is unnecessary :D Although there are strategies which I consider as risk-taking and stupid.

Some time ago I had a similar schedule, but it included two ACM team contests written individually in the night instead of sleeping :P

Do you create your own IOI-like Virtuals by selecting difficult problems or do you get them from some archive?

Congratulations on winning gold. :) How do you keep yourself motivated in working hard and not losing focus? In my case I can devote my full concentration to competitive programming practice during long vacations, but during non-vacation days I suddenly lose motivation and focus to keep practicing due to tiring and stressful classes I endure in my university. After coming back home from university, I usually have enough time in my hands to practice competitive programming, but motivation and focus is lacking and hence, I don't practice much during class days.

How do you keep yourself consistently motivated? E869120

I'd like to share two ideas.

`You practiced for your entire CP carrer, for this 10-hours battle (=IOI). The real IOI is very near, even like a centimeter. You should do put on your last spurt, or you cannot get gold medal in IOI 2019.`

in Japanese. To use this background image, even I was tired, when I start up my PC, I felt like "if I won't practice now, I cannot get gold. This IOI is one of the most important even in my life. Practice!". That's why I can practice >7 hours in weekdays.I think that you can say "I can't practice even if I made this background image" or "I can't endure even a month for me!". But this is all depends on how you want to achieve goal. (For me, getting gold is my big goal in IOI) I succeeded to practice harder because I have very very very strong feeling that I want to get gold medal in IOI.

Profile Image before IOIWhat's your background image after IOI 2019? :thonk:

In the IOI do you code from scratch or you have a prewritten tempelate.

You essentially have to write code from scratch, they do give you bare implementations for each problem but you can't have any of your own prewritten template or notes.

Also, wow, E869120 your schedule is very busy! You definitely deserved the gold medals! One small thing, I think you added up the numbers for the 45-people solved subtasks for 2019 wrong, I added it up and its 407, not 417.

Thank you — you have so good eye!

I made a mistake on calculation task. Fixed. :)