40 points · by Tichy · 17y ago · 27 comments
I was expecting some people to be way, way faster than me, but that seems stunning. Can't wait to see what programming language they used.
Me, I tried to solve the problems in Ruby. I am not that experienced with Ruby, so I lost a lot of time debugging. My solution for problem A was too slow in Ruby 1.8 (only 8 minutes are allowed for computation) and only barely made it with Ruby 1.9 - Google Q&A claimed it should be doable in less 8 minutes with Ruby 1.8, though.
In general I had no problems thinking of an algorithm (except maybe some really clever optimization), but I can't imagine coding them in 7 minutes. My solution for problem B is 93 lines long - even just typing it might take longer than 7 minutes...
I did not practice at all - perhaps with more practice of the typical class of problems for such competitions, it becomes more of a copy+paste thing?
I'm really tempted to give a couple of these a try, but I'm not eligible (Google employee - heh, never thought I'd be disqualified from a contest for that reason), and I'd rather work on my compiler. :-)
(Edit: I just realized that you could look at the problems without logging in. So maybe time measurements only started from the time the user logged in - then you would be right).
The only thing is that apparently in the beginning there was a problem with the downloads, so Google extended the available time. Maybe they only started counting time one hour later. 1:30 hours would still be very fast, though.
Edit: hm, just thinking, supposing the counting really only started 1 hour later, they could have cheated by letting different people work on each problem. 1 hour per problem seems doable. I don't think the counting really started late, though.
So I think the timer just started at 7:00 for everyone. I agree that 10 minutes per problem is remarkable and intially shocking, but I think it's correct because it's proportional to the times that the same caliber of programmers get in Topcoder matches (where 3 problems of on-average-higher difficulty are presented with a total time limit of 1:15.)
If I don't win, they don't need to contact me. If I do win, I can prove who I am. Don't make me go through all this crap up front just to what it's all about. I can't bring myself to care.
It's been said over and over before - the same thing goes for your web site. If you want people to visit, don't create barriers. If you want them to participate, don't create barriers. If you want a dialog, make it clear why it's worth participating.
Interesting to see Google think it doesn't apply to them.
Hey, how would they recruit you otherwise?
A) Trick was to reverse the problem. Instead of checking if different permutations of the test cases matched the dictionary, see if you can build each dictionary word out of the test case. My python solution finishes the large input in about 6s.
B) Nothing tricky here, like others said it just required some debugging.
C) A dynamic programming problem. Work backwards along the reference string finding the solution to each 'subproblem' using the solution for the character following it. Ran the large input in 0.5s.
for C) I wrote about 30 lines in python - 20 of them file handling - to solve the problem (after a few hours of deliberation). What matters is your speed in figuring out how to write a proper algorithm. The codewriting will not take near as much time.
B) is the one where they surprised me the most. It took me about 150 lines to finish off that beast in about 3 hours, and there are definitely errors in the large output even still. I would love to see how they did it.
C) yeah that was the shortest - my first "naive" algorithm was not fast enough, though. I have now thought of a better one and can't wait to try it out, but it is too late for the competition. Still, that alone was worth participating to me - it is a kind of "revelation feeling". I love it when by improving an algorithm a problem becomes solvable.
B) Was actually the easiest for me - the naive algorithm worked well enough. Took me a while to get the program bug free, though...
B) I could solve the sample and the B.1 test case 'looked' like they could have been right but I kept getting incorrect answer on it. It wasn't anything with the dimensions of the map (something I ran into and fixed) so I still can't imagine how you can solve the examples and not solve the test cases.
Kinda fun though...
A) If you're in a language with a good regular expression library, there is a very fast cheesy way ;)
B) I'm equally mystified, I'm satisfied that my solution was correct, but it took 80 lines and multiple passes through the array. I'm impressed that the top tier polished it off in around ten minutes. There must be a fairly simple way.
C) I agree that this one just depends on how quickly you can figure out an algorithm. It's entirely plausible to me that someone with algorithm competition experience has almost literally seen this problem before.
All in all, this year's qualification round is much easier than the last's. No real algorithmic challenges, just boring debugging.