Archive for July 17th, 2008

Google Code Jam: Qualification Round

Thursday, July 17th, 2008

Most of you probably know that yesterday started the Qualification Round for the Google Code Jam competition. In 24 hours there were 3 problems to be solved using you preferred method (or language).

To go to the Round 1 the coder just needed to achieve 25 points. For each problem there were two kinds of input, a Small and a Large one, the correct answer for the small input counts 5 points and the correct answer for the large input counts 20 points, so the only way to go to Round 1 was solving at least one problem for both inputs. I did it for problems A and B. Of course I’ve solved them using Python :-P

Problems.

The first problem was to minimize the number of switches a central engine should make between multiple search engines. You receive a list of search engine names and a list of query, each query is the name of a search engine. The search engine shouldn’t search for itself or the universe will “implode” (or something like that :P ). Well, the basic way to solve this is to always switch to the last next engine in the queries list.

The second problem was to optimize the number of trains that should be in station A and in station B at the start of the day. This given the time that each train leave A and reaches B (and vice-versa). My solution here was to create a list of coming trains (actually of time that the train would be prepared to leave) for each station and then popping out them when a train that should the station leaves after one came (so you reuse the train).

Well, that’s it. Now let’s get ready for Round 1 :-)