Horse Racing Duals puzzle discussion

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.


You’re printing to stderr only. There is no code that prints to stdout. You need to provide answer using printf() i.e. printf(“%d\n”,1);

J’avais le même problème et quand j’ai pris en compte que la différence pouvait être de 0, tous les tests et valideurs sont passés

Hello,

My issue is about the validation tests : when I work on the IDE, only 3 tests are displayed and my code passes all of them.
However, when I submit it, I’m being informed there are 8 tests and my code failed two of them. And I can’t access the description of these tests.

Am i missing something ? Is it because I’m a new user ?

Thank you in advance !

It’s not because you’re a new user.

On the IDE, you can see visible test cases only.

When you submit your code, it is assessed using another set of cases called validators. They are invisible to all players. However, you can still check their titles (descriptions) by clicking “DETAILS” under “MY REPORT”.

You have to improve your code so that it can pass all the validators.

Okay, thank you very much for the explanation !

Salut, comme personne n’a addresse le probleme, je viens informer que si on utilise quicksort seulement ca time-out mais si on randomize le tableau de int avant de faire quicksort ca evite le time out parceque ca evite le worst case ou le pivot est toujours le plus grand ou le plus petit nombre. Pour resumer il faut trouver un moyen d optimiser son algo de tri , merge sort marche egalement . J ai fait le probleme en C.