ANEO Sponsored Puzzle discussion


I did the same mistake. Thank you for pointing that out. You saved my day :slight_smile:


I have the same problem as you do, did you solve it?


i’ve been able to complete this puzzle 100% but am not really happy with the solution I wrote, quite hacky and doesn’t look especially nice, so I was wondering if anyone could advise me on where to look for inspiration as to how i can completely remove any float or doubles from my program.

I’m currently (in C++) converting all my discrete speeds (Km/h) into m/s such that I can more easily calculate whether I can get through each traffic light, but as can be expected some of those conversions end up with rounding errors.

Any advice would be very much appreciated.


Hi everyone
What is the distance between 2 redlights ? I supposed it s the same distance than between first redlight and starting point ?
But it’s not specified


yes, it is:

An integer distance representing the distance of the traffic light from the starting point (in meters).

If you have the distance from the starting point for 2 different traffic lights, then you know the distance between them. (straight road)


hi everyone
I want to make a function that tell me if the speed is good to pass a light number i
with python

def vert (i,speed) :
temps_darrivee = distance[i]/speed
rapport = (temps_darrivee/duration[i])

if int(rapport)%2 == 0 
    return True
else :
    return False

what do you think ?
my algortihm passes first tests but not all of them… I dont understantd why.

Thanks for ur help


Why doesn’t it pass them?
Put some debug prints, and analyze the algorithm by hand. What’s going in, what’s going out - with intermediate calculations - what would you do by hand…

Hard to tell without the input


Can’t pass this without the validator saying I have hard-coded solutions - which I don’t.

Tried two approaches:

  • one exact, which failed on the last test because of the 88.848 issue;
  • one integral (and boring but simple) which passed all the tests.

In both cases, the validator complained. So screw you, I’ve got better things to do.


Can anyone explain me why 78 is a bad answer to that test?

300 30
1500 20
3000 10


Yeah sure.
You arrive at the 1500 light after 69.23 seconds and its duration is 20 seconds, so it is green between 0 and 20, red between 20 and 40, green between 40 and 60, red between 60 and 80.

The 3000m one will be red too


#$@&%*!!! Damn, i’m so blind. I guessed distance is from the last lights so i was summing it up. I don’t understand why it passed first four tests xD Pure luck. Thank you a lot. Now only 7 and 8 are left, but that mean i’m pretty close :smiley:


So my algotrithm passed all testcases,
but when I submit, doesnt pass 6 & 7, “to prevent hardcoded solution”

but my algorithm is not hardcoded.

Do you have any idea why ??
I put round() somewhere because sometime calculated 59.99999999 (instead of 60) and got wrong.
Do you think this is why ?



Thanks. I founded the pb, it was going out 59.999999999 at one point (instead of 60) so I put round() (im with python).

And now it passes all the test. But when I submit, says I have hard coded solutions… no idea why ! :slight_smile:


Thank you for this reminder; it helped me get through the last test and eventually scoring 100% :slight_smile: