← All posts
← →

Nobody took me to olympiads, then I won IOI gold

2002

I started programming in 5th grade and got hooked. We used to brag to each other about how many programs we had written, even simple ones like solving an equation, and the count went into the hundreds.

The problem was getting to a computer. There was none at home; at school you could stay for a few hours after lessons. Summer was the worst. Once, during the holidays, I sneaked into the computer room and was quickly thrown out. It is just so interesting to set yourself a task and solve it, and then to compete with others.

In 9th grade they wouldn’t even send me to the district informatics olympiad: “You’re still too young.” In 10th grade they finally let me go, but I got stuck on a tiny maze there, as I didn’t know recursion yet (a separate story). It hurt that nobody saw a programmer in me: all the attention and the laurels went to three older students.

In 10th grade I started the courses at Progmeistars, and in 11th grade I got into its elite olympiad group. A few months later I took first place at the district olympiad. I was so happy that I skipped all the way home.

In 12th grade I prepared even harder. Because of the olympiad I was exempt from the school final exams, so instead of going to school I sat at home solving olympiads from previous years. That is when I realised the international olympiads were actually easier than our Latvian ones: the Latvian problems were hard, while the old international ones I was solving left and right.

That year I took 2nd place in Latvia, bronze at the Baltic olympiad, and gold at the International Olympiad in Informatics in Korea: 18th place overall, listed in the results as Andrejs Ivanovs. My teammate Alexander Belov won gold too.

The Latvian olympiad silver also got me into university without entrance exams. For me that was the main thing: I would have passed maths, but Latvian hardly, and competition for the University of Latvia was stiff. Everyone I knew was going to Riga Technical University; I was advised to go to the University of Latvia. For a long time I didn’t know where to go, and I went to an open lecture at the university. They told us how programmers work: in 2002 a beginner student programmer could earn 200–400 lats, and a good programmer more.

At the Latvian olympiad, on 25 March 2002, I was the only one in Latvia to score 100 on the problem “Operācija @”. On the digits from 0 to n an operation @ is given by a table, and it is neither commutative nor associative, so the placement of brackets changes the result. Given a string of up to 250 digits, x1@x2@…@xk, you have to say for every digit t whether brackets can be placed so that the expression equals t. Two seconds per test. The idea is dynamic programming over segments: for every segment of the string you keep the set of values it can produce, and the set for a longer segment is built from every way of splitting it into two shorter ones.

Reception for the IOI 2002 medalists

How the trip to Korea itself went is a separate story, and the problem I never solved is “A 65-point stub”.

IOI 2002 turned out to be unusual: the problems were hard. As I remember, only twenty or thirty people scored even half of the points.

The IOI 2002 contest hall

The IOI 2002 contest hall: my teammate Alexander Belov at his computer. This is what the olympiad computers looked like then.

At the olympiad a French contestant sat next to me. He complained that they had spent a whole week preparing instead of swimming and going to the beach. I had been preparing all spring, and it was one of the happiest times of my life.

With Sergey Melnik after the award, 2002

My coach Sergey Ilyich Melnik (left) and me leaving the government building, where we were awarded for the IOI gold. 2002.

For IOI I was given a prize: an HP Tablet PC convertible, a tablet whose screen swivelled round to turn it into a laptop. I was already a first-year student by then, and it was the first laptop any of us had. It lasted about three years.

What I took from it: the result comes from the volume of real practice, and from enjoying it.