ANEO Sponsored Puzzle discussion

Btw, is there a way how to calculate the right answer without trying all speeds till you found the one that works?

2 Likes

Where can you post your solution and see otherā€™s solution?

1 Like

Hey,
My python code was able to pass all the test cases given, but once I submit the code it shows that the code failed validators 06 and 07. Is there anyway that I can know what my problem is through the IDE? Or is it just a bug?

I suspect youā€™re running into the same issue I had with long decimal places.
Simply reduce this example: Before: [50.1234567890] After: [50.123]

Had the same issues. Test cases 8 and 9 expect you to use a speed at which you would cross some of the lights .000000000001 seconds before they turn green. While itā€™s common practice to have a tolerance for floating-point comparison it makes little sense to me in this context.

2 Likes

solved the question by looping all the speed value in km/h in integer form (looping in descending order, of course)

some one asked whether there is a ā€œnon-brute forceā€ method. Personally, i think the nature of this question is similar to those ā€œp x np problemsā€, where it is easy to validate the possible solution, but rather impossible to construct a possible solution.

4 Likes

Yes there is. Iterate through all lights, whenever the current speed is too fast for one calculate the speed you would need to run it as soon as it turns green again, then repeat.

[no full solution, please]

1 Like

Hi, I am trying to solve this puzzle. Regarding the last test, I have the impression that 89 would be a right answer, whereas 74 is expected. Could you have a look and explain me why 89 doesnā€™t fit?
Regarding the rest of the tests, i am getting the expected results when running my code in Visual Studio Code& Dot Net Core Framework, but results are on the site.

1 Like

I passed the test but i want to know if there is a solution with time complexity < O(n^2) ?

What is n?
I solved it in O(maxSpeed * lightCount).

n = lightCount
I also have O(lightCount^2), which I think is better then maxSpeed * lightCount

lightCount <= 9999
maxSpeed <= 200

so maxSpeed * lightCount < lightCount^2
Thus my solution is faster on big inputs (assuming that I donā€™t have a huge constant that you donā€™t have).

Hi,
solving with bruteforce with external loop on speed and internal loop on lights is too easy.
A ā€œwhileā€, a ā€œforā€ and an oddity test, and I did with 7 lines of javascript code (and I got my 100% achievement).
But I think this is not the spirit of the problem, I feel like having cheated.
Iā€™m trying to do it with a more sophisticated method, but I got a 90% because of Validator7 that refused to pass :wink:

2 Likes

Solution requires answer be an integer and running this ā€œfinalā€ integer answer again through the algorithm is necessary to ensure it passes (particularly the last one - 88.848 = 88). Running 88 through the algorithm produces the correct answer 74. Otherwise, I had no problems working with floats.

Hello everybody!
Iā€™m new on codingGame and more generally in programming. I passed 50% of the tests for this puzzle (1, 2, 3, 4 and 9). Is there a way to know was is exactly tested by each test? It could help me understand why i didnā€™t pass the other 50%. I have no clues and itā€™s a bit frustrating. Also are the solutions to the puzzles available somewhere?

The tests in IDE are available in the IDE. (Three lines button in the test cases panel)
The validating tests (after submitting your code) are not available.

If you fail them, hereā€™s my advice:

  • check the title of the validator that fails; it can be a hint for your mistake (I didnā€™t check for the Aneo puzzle)
  • read carefully the statement another time and skim the related forum thread; someone might have had the same issue and had it resolved.
  • if youā€™re still stuck, I can help and give you the validator.

and welcome to CodinGame :slight_smile:

1 Like

Thanks! i could validate all the tests!

This has to be the worst excuse for a puzzle I had the displeasure of solving on this site. I reluctantly took the effort to complete it anyway since CG wonā€™t allow me to rate it otherwise.

There is nothing educational or informative about this puzzle. You just have to recreate arbitrary choices/assumptions by the party who implemented the validators. Now we arrived at ā€˜use a random arrangement of float precision and integersā€™ and somehow along the way it also made sure double precision doesnā€™t agree with their incorrect answers. (You are in fact crossing lights before they turn green in the expected answers.)

This arbitrary choice also explains problems for people using languages like Python because it automatically and often implicitly uses double precision number representations which makes it frustrating to obtain a good float precision. (Since you have two unknowns: figure which step needs to be float and how precise should that float be.)

Itā€™s kind of uncomfortable that you chose this to represent a partner businessā€™ presence on the site as well.

21 Likes

Hi guys,

This question has been maybe already posted, but I didnā€™t see it (Iā€™ve read quite fast other answers :stuck_out_tongue: ).
Python3 test 1 & 2 do not pass becacuse it expects ā€˜Nothingā€™. In other languages as Java or even Python2 this is not the case. Thank you anyway! This is a great platform :slight_smile:!

Check if you print an additional line after the answer in those tests.

1 Like