Competed in an ICPC programming competition today! The saga starts out cold and stormy for our hero, when after the opening breakfast at 11, Eclipse fails to load on the lab computers. I boot up Emacs, refresh myself with the command-line java compiler and JVM invoker. Pain ensues as I can’t remember basic Java syntax (the UW teaches nearly everything in Java btw). Everyone is getting their balloons tied to their desks for solving problems, and I still have none :/ I consider throwing in the towel and going to sob over some Nutella and cheap sliced bread.
But after pain comes gain. I start wrecking problems. There’s a scoreboard which tells you which problems everyone has solved, so like a shark seeking blood I hunt down the easiest problems. More pain ensues because an annoying easy problem requires you to read in a string that doesn’t fit in memory, so it needs to be read bit by bit. But I can’t read it with my simple Scanner object that consumes tokens. And this is a no-Stack-Overflow zone. So I pull up the cached docs on BufferedReader
and InputStreamReader
, and, 40 minutes later, the stupid problem is solved.
Then, the real gain. I realize that the problems have the form,
- Mathematically restrict an enormous search space
- Algorithmically search what remains.
Finally, I get my second, then my third problem, slowly overtaking the fast-starting 1-ballooners. The fourth problem yields with a lot of careful effort (I had to remember how to compute the area of a triangle with a cross product; those that computed it with sines and square roots failed on grounds of precision).
Then, in the last half an hour, I frantically attack a problem about box hedges. 5 problems would get me up with the real brass. But I can’t quite get it in time–I catch my crucial mistake just as time expires.
I bask in my surprisal over how much I enjoyed the contest, and chat about solutions with my buddies. Kalina, who also only solved four, refuses me a fist-bump on grounds of self-disappointment; a C++ whiz, she solved the first 3 problems in about 20 minutes but then stalled out. My pal Simon, on the other hand, with 5 problems including a subtle graph problem, makes it to the 2nd ETH team and wins a trip to Paris. We realize ALL of the problems have a hook–if you can just figure it out, the problem doesn’t look so intimidating.
Also chow on Domino’s and drink the provided beer. My buddies leave; I have a fun conversation with one of the contest organizers then head back to Culmann for dinner; relax for the rest of the evening.