[Community Puzzle] By train or by car?

The times you have given is for the whole journey, instead of just between Jarnac and Cognac. It confused me for a while :sweat_smile:

Anyway I have checked the code you sent me in PM, and found that you have not made any calculation errors. Your error is instead in the formatting of the final answer. Please check that part of the code again :wink:

Oooh indeed. Not very proud of this one :laughing: Thanks for your help !

For future readers, I transformed the list of trips into an object, using the starting point as the key and containing the destination and the distance. Then I take the object property named as our journey starting point. If the destination isn’t our journey destination, I take the corresponding property and so on until finding the right destination.

What is the validator for test 6 ?? because it fails even if it passes the test provided in the IDE. does someone know what is the problem ?

I dont know what I’m doing wrong. I’m always have 7/8 passed.
If I use floor() in Swift, for the last test I have :
Found :
CAR 2:25
answer :
CAR 2:27

And if I use (Ceil() + floor)/2, The last test passed but the test before not
found :
CAR 1:48
answer :
CAR 1:46

Someone else have the same issue ?
UPDATED : I use (round() + floor())/2 and I still have test errors for the two last entries. But My code passed the puzzle with 100%

You don’t have to round any intermediate numbers during the calculation. You just need to floor the final answer for output.

If that is not the issue, you have made some other errors in the calculation.

I can’t manage to pass validator 8, even following your advices (flooring at the end).

Pretty sure it’s a matter of formatting, the instruction are already inconsistent with the test :

Format for the duration: hh:mm

Actual result in the tests : CAR X:XX

I’ve updated the statement so that it reads h:mm now. Thanks for raising the inconsistency.

The validator itself needs no revision because the answer has always been in the format of h:mm.

May I send you my code so you can tell me if it’s a calculation or formatting issue on validator 8 ?

OK, you may PM me.

Hello !
I seem to have the common problem of only failling validator 8 and not having a clue why :sweat_smile: if someone can help me I would really appreciate it !

Quite a few people get the number format wrong in validator 8. Try checking the numbers from 0 to 59 to see if that is your case too.

I checked my formatting from 0 to 250 and noticed no problems :confused:

You may PM me your code and I’ll take a look.

done ! thanks in advance !

Same issue as this :wink:

https://forum.codingame.com/t/community-puzzle-by-train-or-by-car/194254/13

What is the validator for test 6 ??

It’s not a good idea to share any validators on the forum. However, if you want, you may send me your code in private message so that I’ll take a look and see what may be the issue.

Hello, all the test is ok, but the 6 validatior not ( 6 Pithiviers Nantes ). I don’t know why?
Could you help me please ?

what i have to know to solve this puzzle i tried loops but it give me Process has timed out

Is it just one test case, or the entire puzzle, that you can’t quite figure out?