ACM CodeFest 2.0 Problem-Car Race

The solution was pretty easy, but either I seem to make some mistake in my implementation or my idea for the problem is incorrect. Could any one help me point out which one it is!
UPD: Apparently it works with this code.
AC Solution