Horse Racing Duals puzzle discussion

Moderators can’t see official puzzles’ validators nor they can validate or refuse solutions.

Hi ! Does it mean we have to pass the puzzle validators by any means ?

Yes, nearly.

Hi yall, I’m having an issue, I’ve solved this puzzle in 3 different languages: C++, JavaScript and Dart;
The solutions are basically identical between them, but the Dart code times out during the “Many Horses” test. Now I can believe that the C++ code is faster than the Dart code, but JS passing the test while Dart can’t, that seems suspicious…

Please refer to my answer here and see if it helps you.

1 Like

Indeed, this solved my problem, many thanks. However, it is kinda weird that this is necessary. Do you have any idea why?

I have no idea :sweat_smile:

I have created a series of code solving videos for Horse-Racing Duals. The video’s walkthrough demonstrates how to approach the problem in a way new programmers can follow. They demonstrate using a flowchart when solving the challenge and some troubleshooting when you run into problems. You can watch them in order and follow along to solve the puzzle with me, or you can pick and choose the videos that work best for you. The whole playlist can be found here: https://www.youtube.com/playlist?list=PLA696TZkxEnKs8vaVe4QEbQDDMkUdaZHK

Something weird about the Kotlin implementation which times out in the 3rd test. The Java and Golang implementations worked even though they were not as optimized as I did in Kotlin.

Kotlin can be slow on CodinGame, but it’s still doable for this puzzle. Groovy times out even more frequently on various puzzles.

Hi, this exercise isn’t working on dart on my side, i have a timeout exception for delay even if i don’t touch the code for lot of horses test

Please refer to my answer here and see if it helps you.

s=?, i don’t konw.

Hello! I get stuck with the horses in a strange way. Language is python 3. 2nd case with any order. Checking my code in Pycharm - everything fine. In game - nope. Already tried different ways to solve it (Sorting etc). In game answer 27 instead 1. When running enywhere else - answer 1. Give me some directions, please:

[Mod edit: Please avoid posting codes on the forum]

You may consider walking through your code step by step to see how the variables change during execution, and whether they change to some values different from what you expect them to be. Mostly probably you have updated them in a wrong manner somewhere in the code because how you re-implement inputs in Pycharm is different from how inputs are provided to you here.

I would also suggest reading all the inputs before you process them, i.e. reading and processing in two different for-loops, instead of processing the appended list every time after you read a new strength. Of course, this is just a suggested approach; you can do it in any way as long as it works.

Hello,I think there is a problem with the input, in the C language
on the first test when i do :

for (int i = 0; i < N ; i++)
{
int pi;
scanf(“%d”, &pi);
fprintf(stderr, “%d\n”, pi);
i++;
}


but when i do : i < 5 it input me the good numbers

you already have i++ in the for. the other i++; messes it up.

1 Like

image
image
still not working (mb for the i++ it was late i tried too much shit thing)

I don’t see all code, but that means your code doesn’t print anything to stdout.