TopCoder Single Round Match

Last night I participated in a “code fest” sponsored by my employer. It was great fun and the code fest was powered by TopCoder. This was my first time participating in any sort of coding competition and while I didn’t make the top three, I did place in the top ten. I’m definitely looking forward to the next company sponsored event in February. For those of you not familiar with TopCoder, they basically provide a Java application/applet called the Competition Arena. Once you login to the arena, you can then register for a Single Round Match (SRM, in TopCoder parlance), but only during the registration window (which appears to be two hours prior to the event). Once the event begins you have 75 minutes to solve problems of increasing difficulty. Each problem set is assigned a certain number of points (usually 250, 500 and 1000). You are judged both on the correctness of your program as well as the time it took you to develop and test it. Since you must develop, compile and test your code in TopCoder’s arena Java app you can only write your solution in C++, Java, C#, or VisualBasic. I wish they offered Ruby as an option (or even Python), but at this time you’re stuck with those four choices. You are allowed to choose your programming language at the problem set level (i.e. you don’t need to stick with the same language for all three). Since the majority of my experience in the past ten years has been with Java I selected that for all three of the problem sets. In retrospect, I might’ve fared better had I chosen C++ as that is what I’ve been using almost exclusively at work these past three months. I also need to manage my time better as I ran out of time just before I was going to submit my solution to the 1000 point problem—I believe that had I finished in time, I would’ve placed in the top three (I guess we’ll see when I participate in February). Once the content ends, you’re able to look at the solutions from the other participants and can challenge their solutions if you believe you’ve found a bug. If your challenge succeeds, you earn points and the person challenged loses all of the points for that problem, but if your challenge fails, you’ll lose points and the person challenged will gain points. There were a few successful and unsuccessful challenges during the competition. Looking through people’s code it was clear that the folks who had participated previously didn’t bother indenting their code properly or ensuring it was clear—they focused on getting it working in the shortest time possible. I made the newbie mistake of properly indenting my code and even writing psudocode comments as an outline prior to writing the real code (next time I’ll do this on paper if necessary). I also was hampered slightly by the Arena editor as it uses the MS Windows keybindings even on the Mac! Thus CTRL+C is copy instead of CMD+C — I kept hitting the Apple shortcuts instead of their Windows counterparts and this slowed me down as well. My colleague suggested just keeping Emacs open and copy and paste as necessary into the Arena editor. Unfortunately, I cannot post the problem sets here as they are copyrighted by TopCoder and you must have permission to republish them. But if you go to the TopCoder site, you can see many example problems. If you’re interested in petitioning TopCoder to offer Ruby as an alternative language for competitions, I urge you to email them, as I have. Update 2006-12-21: I received the following response from TopCoder and have asked them to add Ruby as an option for “Marathon Matches”

We do not allow interpreted languages like Python or Ruby in our algorithm events because their execution speeds makes them non-competitive compared to the other languages. We revisit this from time to time, but our tests have shown that the execution speed makes writing problems that keep all languages on the same approximate playing field impossible. We do offer Python as a fully supported language choice in our Marathon Match events, where we can relax the constraints because of the non time-critical nature of the event. You can find more information about Marathon events on our web site under “Marathon Matches�