See: https://code.google.com/codejam/
I'll be participating
And note the score displayed on the standings page is "optimistic", i.e. it assumes you get full points when the hidden results are revealed.Kirby wrote:I see it now - 25 points. Cool.
What do you mean by "breadth first search" in this case? The trick to the first one is that there is always one highest possible value swap. We can disregard all trailing Cs, then there is an irrelevant prefix followed by a number of S characters. Swapping the first of those S with the previous C will give you the maximum reduction. Example: SCSCSSS -> SCSSCSS.Kirby wrote:Well, that was quick - I'm out already. I only attempted the first two problems, and while they passed the small set on the first attempt, the large dataset gave TLE for both. I didn't do any sort of special optimization for either - just breadth first search for the first problem, and pretty much a straightforward implementation of the second.
Oh well. I guess I should have tried the other two problems, too (or thought about perf more, maybe).
I didn't try to do any trick. For any given string, I swap each pair of consecutive characters to generate a bunch of new strings (each one representing a possible hack). I add these to a queue for the breadth first search I'm doing. Every time I pop something off of the queue, I check to see the damage. Also, whenever I add to the queue, I'm actually adding a pair to also indicate how many hacks I did to get that string. The unmodified string has 0 hacks, the first set of hacked strings all have 1 hack, the next iteration has 2 hacks, etc.bernds wrote:
What do you mean by "breadth first search" in this case? The trick to the first one is that there is always one highest possible value swap. We can disregard all trailing Cs, then there is an irrelevant prefix followed by a number of S characters. Swapping the first of those S with the previous C will give you the maximum reduction. Example: SCSCSSS -> SCSSCSS.
I implemented the quadratic bubble sort, literally taking the pseudocode from the problem description.In the second one, one has to not implement the quadractic bubble sort.
Which language were you using? Perhaps something turned out not quite as portable between systems as one would hope.HermanHiddema wrote:For problem 3 I still have no idea what went wrong. My solution was quite efficient (equivalent to the more efficient solution mentioned in the analysis) and solved all test cases locally (using the provided test script, adjusted to give all sorts of test cases), but when I submitted it, it reported a failure with "Runtime Error" and I had no real way to debug.