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

# ANEO Sponsored Puzzle discussion

**UndeadKnight121**#112

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.

**Sarah19**#113

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

**_CG_Thibaud**#114

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)

**Sarah19**#116

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

**hoeskioeh**#117

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

**aSparrowNamedFrancis**#118

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.

**Kirbiby**#120

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

**Z-DNA**#121

#$@&%*!!! 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

**Sarah19**#122

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

**Sarah19**#123

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 !

**PhilipHassel**#124

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