# [IOI 2014 Part 0] Waiting

Yes, I know day 1 of the contest already ended and is probably a more interesting topic to blog about, but I finished writing this last night just before the internet was cut off to quarantine the contestants from the leaders, who received the problems and began translating them. I didn’t know about this until it was too late, which is why I’ve been waiting since yesterday to post this.

To provide a counterpoint to the last post, one of the many, many advantages of entering an international competition is that you get to meet a lot more people you already know, so there’s less time spent being socially awkward. While waiting for stuff to happen, aside from all the expected time spent with the Taiwan team, I also talked to, played games with, and otherwise entertained a whole lot of people I already knew, including my schoolmates (no less than fourteen of them were volunteers) and some of the college students who had shepherded us around during olympiad training.

Which is a good thing, too, because there was a lot of waiting.

First I waited for my teammates; my parents had decided to take me to the hotel (Fullon Shenkeng) directly, since I had a lot of stuff, and I had arrived early. This took about an hour, after which we had lunch. Then I waited for the hotel to give us our room cards, which took about five hours, after which we had dinner. Finally, at night, I waited for the Codeforces system tests. Very nerve-wracking. But I’m getting ahead of myself.

Advantage #2 of being the home team: you can talk to all of the organizers and volunteers fluently, so you can get them to help you more quickly. Although we waited for our room cards for an obscenely long time, I got the volunteers to replace my pinyin-name-card with a legitimate one that said “Brian” on it really quickly.

Unfortunately, after I talked to a few more people, it looks like they aren’t going to change my name in the database. So if anybody reading this chances to look at the IOI live ranking and is unable to find me, look for the first name “Po-En”.

Our room was very nice, except perhaps for the fact that there was a window between the main room and bathroom — a large clear glass window reaching from the ceiling to the rim of the bathtub. The window featured a curtain (I don’t want to think about what we’d do if it didn’t), but it was pulled all the way up when we entered the room, and the second afternoon we discovered that whoever cleaned the room had pulled it up again. I still can’t figure out why there would be enough demand for such windows to justify designing hotel rooms this way and having it pulled up by default. We joked that it could be worse; the window might be facing the hallway and the curtain might be controlled from the other side of the window.

The “talent show” the first night turned out to be more of a game-show competition gig, where contestants tried blowing ping pong balls out of bowls of flour and passing rubber bands with energy bars held in their mouths. I didn’t stick around, though, because there was a Codeforces round that night at 9. Unfortunately, the hotel’s internet was not stable. Fortunately, I still did really well, attaining my highest ranking in a Div I contest to date and making up for my loss in the match before. Hooray!

And so, Day 0 rolled around. I thought that the practice session would involve the three painfully easy problems that we had been given long before the competition itself. Even though I heard some rumors to the contrary later, it turned out that my first guess was right.

Still, there were a lot of things to figure out.

First, the software. Our computers were Acer laptops running Ubuntu, with a nice neon-blue IOI 2014 desktop background. I was looking forward to the Ubuntu workspace switcher, but I couldn’t figure out how to use it; I dug around in the system settings for a while before I found that it was disabled by default.

Also I realized that I had forgotten what my basic .vimrc looked like, which prompted a whole other struggle as I tried to remember my mnemonic and type out the settings. This took another while.

At last, I began to seriously try to solve the sample problems as I would under the official environment. In doing so I discovered that when the provided sample input for square, completely untouched, was fed into the provided sample grader, also completely untouched, an assertion error came out.

The grader contained the fascinating line assert(scanf(" "));, which, since scanf returns the number of format specifiers filled, and there are zero format specifiers in " ", is (as far as I can see) guaranteed to fail.

But I didn’t know that at the time, so, even though I realized I could just comment out that part of input-reading and get an output, I was still very confused. My immediate attempt to find some blue-shirted technical guy to help was rebuffed; they said they couldn’t answer such questions. After a while, a communications message came through explaining that they put the wrong version of the grader on the computers and promising that nothing similar would happen during the actual contest. Oh well.

Next, I realized that as much as I loved abusing C++ lambdas now (not in any notably functional manner, just allowing me to write subprocedures while passing around the minimal number of locals), I did not know how to specify the type of one, and the compiler was not smart enough to infer it in time for recursion. With some help from johnchen902 (TWN1 or 2, depending on who you ask?) and some help from the local copy of cppreference.com I figured this out, and wrote a recursive lambda with type std::function<void(int,int,int,int,int)>. I also learned about the precedence of type operators for declaring pointers to arrays and arrays to pointers. Urk, I thought type inference was a solved problem already.

Finally, after much coaxing from our leader, I printed a few copies of the std::function<void(int,int,int,int,int)> code. I leafed through gvim’s wonderful documentation and learned how to make it print line numbers: :set popt=number:y. One more line for .vimrc.

As for the equipment — I wasn’t professional enough to bring my own mechanical keyboard or anything (“that’s a hardware problem!”, quoth the programmer), but when I realized that not even a mousepad was provided, I turned in the one I had stashed in my backpack to the organizers so they could check it and allow me to use it during the contest. Along with it, I also turned in my favorite mechanical pencil, my eraser-tied-to-ruler, a box of lead, and a pen. All this was placed in a garbage bag that an adult human could probably fit inside.

Afterwards, in yet another round of waiting, we killed time by playing weird games on our laptops. There weren’t very many obvious ones, so despite being a vimmer, I managed to bring up the list of games in emacs after hitting M-x help and following directions out of desperation. Whew. It turned out that this round of waiting was wholly unnecessary because our two teams were both killing time waiting for the other to finish, so that we could go have lunch.

I believe this is what multithreaders call “deadlock”. Luckily, I managed to receive an interrupt signal by wandering over to our other team and asking what was happening. Thus concluded the practice session of Day 0, and although the opening ceremony and various other fun things followed, I’m going to stop now; my fictional audience of zero has probably been waiting long enough already.

There. I hope I’m living up to my standards for witty and cohesive post titles two years ago.

(note: the commenting setup here is experimental and I may not check my comments often; if you want to tell me something instead of the world, email me!)