Feel free to send your feedback or ask for some help here!

# ANEO Sponsored Puzzle discussion

**matleg**#2

Hi, thanks for this new puzzle!

I think there is a little mistake in the summary, the distances can go over 9999m in some tests!

1 ≤ distance ≤ 9999

Shouldn't the 50% and 100% achievements be combined as for other puzzles?

And the link at my last gained XP leads my to my profile rather than to the puzzle (but that seems to happen to all links now).

Shouldn't the 50% and 100% achievements be combined as for other puzzles?

Yes thanks, I'll take care of that immediately

**Mr_Saint**#7

I noticed that the speed is in km/h whereas the lights are measured in meters (distance) and seconds (time). The solutions asks for an integer. I would expect that might cause some issues as 1 km/h is 0.277778 m/s. Could someone verify if that's not the case?

So long as you get the second right, it all clicks into place. Overcoming the discrepancy you describe is part of the the puzzle.

**ilimi**#9

Hmm. Validators says I have a hardcoded solution. But I honestly write the code. How I can fix that?

**lakeoverflow**#10

storing the speed in m/s internally was a bad idea, ran on all sorts of rounding problems

**monester**#12

speed in km/h and distance in meters and duration in seconds is really bad decision. I've got wrong answer because of pow(10, -16) precision. As soon as I added rount(x, 10) I've passed all tests.

**Kaesebrot**#14

I am able to get through all of the tests apart from the last one. Maybe I have some fault in my thinking or my mistake comes when calculating with meters per second (in Double) and also converting it to Integer km/h just at the end. I get as result that it should be working with 24.68 m/s (or 88.848 km/h). Has someone an idea?

**Di_Masta**#15

I've used C++ and worked with float speed (m/s) and the other calculations in int and passed the puzzle with 100% success.

**Kaesebrot**#16

Hm okay.. I try the other way around, so I don't post any solutions.

Shouldn't this code prove that 24.68 m/s get you through without getting redlights?

```
def proveGreenLight(predictedSpeed):
distanceArr = [1234, 2468, 3702, 6170, 8638, 13574, 16042, 20978, 23446, 28382, 35786, 38254, 45658, 50594, 53062, 57998]
durationArr = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
light_count = 16
for i in range(light_count):
# how much time do I have to spend to get to the light
secondsToLight = distanceArr[i]/predictedSpeed
# calculation if it is a green or red phase
period = secondsToLight/durationArr[i]
if(int(period) % 2 != 0):
return "red"
return "green"
print(proveGreenLight(24.68))
```

-> "green"

**Kaesebrot**#19

That produces the same output:

*period* is odd:

int(period) % 2 **-> 1**

int(period) % 2 != 0 **-> True**

*period* is even:

int(period) % 2 **-> 0**

int(period) % 2 != 0 **-> False**

**cg123**#20

If you can drive precisely at 88.848 km/h, so yes all lights will be green.

But are you sure your regulator is precise enough to accept a speed with decimal precision?

**Kaesebrot**#21

Okay thats probably the point. 88 or 89 km/h will not get you through without getting redlights. Thanks guys

**kaida**#22

you arrive at light when red -> green you are okay; when green->red you arrive at light, sorry you break the traffic regulation........... XD，XD，XD