Hi Marcel, thanks so much for your response! I have found the problem and it 
turns out that my suspicion about the judge not interacting was a bit of a red 
herring - I'm so sorry about that. Somehow right before uploading my code I 
ended up with a stray println that I was using for debugging, which obviously 
mucked up the synchronisation with the judge. Then, when I went to debug with 
the code I provided above, I didn't realise that I seemingly need to read the 
judge's verdict (following System.out.println(5);) before it will let me 
interact for the next iteration. This is good to know.

I'm getting a little rusty on my Java because I don't use it much anymore, but 
my understanding is that System.out will automatically flush the buffer after a 
newline character/println call. This certainly didn't seem to be an issue after 
I fixed the other bugs.

Thanks so much for sharing your code, it was really helpful for working out 
that I needed to read the judge's verdict. I'm pleased to say that my solution 
also passed both test cases once I fixed the IO problem, but yours is a bit 
more elegant. Best of luck with the rest of the competition!

Geoff

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/766a4b27-1c0f-4f92-9b92-6e92afb8e28e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to