Coming soon

IOI 2024 will be hosted by Egypt. Visit the official website to learn more.

Coming soon   IOI 2024 in Egypt

Interview: Benjamin Qi

In this interview, we will talk with Benjamin Qi, the winner of IOI 2019 (which took place in Azerbaijan) and IOI 2018 (which took place in Japan).

Among other topics, we will talk about how the IOI team is selected in the USA, what platforms Benjamin uses to prepare for competitions in informatics, and various other topics related to the IOI and competitive programming in general.


1. Ben, if you do not mind, I would like to start with you giving us a quick introduction about yourself.

 Hello, my name is Benjamin Qi. I’m from Princeton, New Jersey and I’m currently studying for my MIT final exams. I am also preparing for a training camp organized by the USA Computing Olympiad (and participating in programming contests, of course).

 

2. How did you start with programming (do you remember at what age), and do you remember what got you into competitive programming in the first place?

 A few friends from math contests mentioned the USA Computing Olympiad as something that could be interesting to do, and I decided to try it out. It was the summer after 8th grade, I think I was 13 at the time. I started with USACO training pages and worked through most of them during the summer. Along the way, I also found Codeforces and participated in some contests there.

 

3. Can you tell us about how the IOI team is selected in the US?

There are 4 divisions of the USA Computing Olympiad, and among those, platinum is the highest - about 26 of those contestants get selected for USACO training camp, and approximately half of these must be first-timers – the other half is usually the top-scoring participants and those are the ones that are mainly in contention for the IOI team. The campers do 6 more contests in order to select the team representing the USA.

 

4. What is the best way to practice, in order to be successful at programming competitions? For you personally, but also for anyone else reading this, is it a good idea to do a lot of practice on online judges, should you solve a lot of easy or hard tasks, and should you spend time reading books/articles/blog posts?

Of course, you need to solve hard problems. I would not do CodeForces Div2 or Div3 contests on a regular basis – those are just too easy - even though I see some grandmasters still doing Div. 4 :). As for hard problems, you shouldn’t spend too long on them – sometimes, I just skip directly to the editorial (although it’s unclear whether this is a good idea in general). For Olympiads specifically, check out https://oj.uz – it has a lot of Olympiad problems from various sources. You can order the problems by the number of solves; start with the easiest ones and go down the list.


5. What is your favorite training website or online platform, where you spend most of your time on? Can you recommend a good book about algorithms or competitive programming in general?

My favorite training website is the USACO Guide. I use Codeforces a lot, as well as TopCoder and https://dmoj.ca. DMOJ has monthly contests during the school year which are fairly good – although the problems aren’t always original, implementing “standard” algorithms is nevertheless quite important.

AtCoder is definitely the best when it comes to tasks, but they don’t always hold Grand Contests frequently – mostly it’s just beginner contests at the moment.

I recommend "Guide to Competitive Programming" by Antti Laaksonen as a great book (and it’s now available for free, see this blog post). I’d also urge people to take a look at https://clist.by/ to see what other competitive programming websites I use (see my profile here).

 

6. You use C++, as far as I know. What do you think is the biggest advantage of the language? You have certainly seen a lot of examples of solutions written in other languages as well. Do you have any advice for others using C++, for example, some hidden features that are really great and useful for competitive programmers?

Some languages are not supported at every platform or competition. So, for example, at the IOI you are not guaranteed that you can solve tasks in Java, so there is no reason to start learning Java for the IOI. Sometimes I use Kotlin for contests on Codeforces and it’s more pleasant to code with than Java – though it’s not supported by many online judges.

For C++, I use a lot of macros, which allows me to type things quickly. Check out the templates on my GitHub repository. For example, this allows me to read or print out variables (such as vectors) using fewer characters, and it makes debugging my code significantly easier.


7. What is the best way to prepare for the IOI specifically, based on your own experience? I guess there are some differences compared to being successful at online competitions or is it maybe all the same to you?

Probably the most important thing is that you should get used to solving unusual (such as output-only and interactive) problems that appear at IOI a lot, but not very frequently in most online contests. Again, I would recommend https://oj.uz because it has such problems that you can practice on.


8. Do you have a favorite IOI task and which one is it (and maybe you can tell us why)? I'm also interested to know if you have a favorite competition (apart from the IOI of course) that you want to win in the future?

I like Seats from IOI 2018 because I was the only person who solved it ;) I also enjoyed Wiring from IOI 2017 and Mechanical Doll from IOI 2018, although I didn’t solve the second one during the actual event.

Regarding other contests, I hope to participate in TopCoder and AtCoder’s onsite events as well as team events such as the ICPC World Finals. Of course, I also want to attend Google Code Jam and Facebook Hacker Cup.


9. You have a very nice repository on Github with source codes and general resources about starting with competitive programming. Do you find that useful (having pre-written codes that you prepare and improve over time), and do they help at all at onsite competitions like the IOI?

For contests where I don’t have access to prewritten code, I try to write my templates the same way I would for contests where I do. It definitely helps to have code that works for common topics such as Segment Trees, which I used for IOI Seats. Generally, it’s a good idea to store code that is applicable to a variety of problems and has been tested many times.

The source codes in my repository are available for others to use, and I update them consistently.

 

10. What do you think about competitions where you get a result for your submissions immediately (like the IOI), or competitions where you don’t know if your submission is correct or not until after the competition? Some people like to know the results immediately, while others insist that testing your code is a very important skill for software developers. Do you have a preference?

Recently I’ve been participating a lot in TopCoder, and your solutions there don’t get tested until the System Test phase. I think that’s okay, and I’ve also gotten better at catching bugs than I was a couple of years ago – however, it’s still pretty annoying and you don’t want to be that contestant who manages to fail system test on all of the problems. :)

For Olympiads nowadays, it would be quite bad to not have full feedback, because you often need to submit a lot of times for various subtasks. Of course, knowing whether your submission is correct or not has a huge impact on your strategy.

 

11. I already asked you about the best way to prepare in order to be successful at the IOI, but there is a difference between learning and preparing to win a gold medal and a bronze medal (which is most people participating at the IOI). Do you have any hints or suggestions for the competitors trying to win a bronze medal, maybe based on your experience when you were starting with competitive programming?

The goal is to earn as many points as possible. You should look at all the subtasks and try to earn as many points as you can. Start with the subtasks that you think are easiest and that you can solve, and just keep doing that until the end of the contest. For example, during my first day of IOI, I didn’t initially know how to solve “Seats,” so I just started with the easiest subtask and worked my way up. That is what you should probably do too, regardless of the medal you are aiming for.


12. Are you preparing for ICPC? Do you have a team, and how are you practicing – is it the same as preparing for the IOI or is it different when you are taking part in team events?

I participated in ICPC this year. I did not have much experience with team events before – working with teammates in person is quite different compared to working individually. We still practice sometimes, though collaborating online is difficult for us.

 

Awesome. Well, thank you Ben for your time, and we certainly hope to see you again here. I wish you all the best, and good luck in all your future competitions and other ambitions you have.

Thanks!

Need more info?

Beginners

Not sure where to go? Click here to view some basic information on how to learn programming and prepare to win a medal at the IOI.

Statistics

A couple of volunteers maintain a separate page with stats about people who participated at the International Olympiad in Informatics.

Journal

The IOI publishes a journal every year, with original high-quality scientific papers related to education, contests and algorithms.