Hi,
I don’t understand, the IDE don’t give me the right N (for the 1st test, N should be 4 but mine is 3)…
Do you have the same problem ?
No. You may try copying out your code, resetting to the default code, and running the default code. You should be able to see the right N. Then figure out how to fix your code.
That’s not how you spell duels…
me too ,
I don’t know what is the problem!
I’m using Dart as a language
I let the first loop to save all values in a list
then I sort it
then I compare every value with its next value but this algo took me more than what proposed
How can I do better ?
A similar timeout issue occurred in another puzzle previously (https://forum.codingame.com/t/stock-exchange-losses-puzzle-discussion/40/150), but that one seems fixed. I’m not sure if this puzzle suffers from the same issue. My original solution which passed the puzzle also times out now.
Hi, Any one has completed in C, I really could not find how to optimise the solution am getting error timeout.
Please read the hint which can be found by clicking HINTS to the left of the puzzle statement. See if that helps you? If not, you may then read the cover page of the puzzle and look for another hint there
I got the solution now.I have used the merge sort and once the array is sorted in perfect time span remaining problems are resolved and all 3 Test case or passed now.
[nope]
Hi guys,
My horses in disorder test passes in the testing part, but it fails in the submission part, all tests are fine expect this one, any idea why is that so?
thanks for your answer.
Please search and read the relevant discussion above.
I am confused why the “Many Horses” test thinks the answer should be 47. The input is all the numbers from 0 to 99998, thus the difference between 2 horses next to each other would be 1. Am I being really obtuse? The answer should be 1, and 47 makes absolutely no sense to me.
You should look again to those numbers.
this is the sorted array:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226
…
99569, 99570, 99571, 99572, 99573, 99574, 99575, 99576, 99577, 99578, 99579, 99580, 99581, 99582, 99583, 99584, 99585, 99586, 99587, 99588, 99589, 99590, 99591, 99592, 99593, 99594, 99595, 99596, 99597, 99598, 99599, 99600, 99601, 99602, 99603, 99604, 99605, 99606, 99607, 99608, 99609, 99610, 99611, 99612, 99613, 99614, 99615, 99616, 99617, 99618, 99619, 99620, 99621, 99622, 99623, 99624, 99625, 99626, 99627, 99628, 99629, 99630, 99631, 99632, 99633, 99634, 99635, 99636, 99637, 99638, 99639, 99640, 99641, 99642, 99643, 99644, 99645, 99646, 99647, 99648, 99649, 99650, 99651, 99652, 99653, 99654, 99655, 99656, 99657, 99658, 99659, 99660, 99661, 99662, 99663, 99664, 99665, 99666, 99667, 99668, 99669, 99670, 99671, 99672, 99673, 99674, 99675, 99676, 99677, 99678, 99679, 99680, 99681, 99682, 99683, 99684, 99685, 99686, 99687, 99688, 99689, 99690, 99691, 99692, 99693, 99694, 99695, 99696, 99697, 99698, 99699, 99700, 99701, 99702, 99703, 99704, 99705, 99706, 99707, 99708, 99709, 99710, 99711, 99712, 99713, 99714, 99715, 99716, 99717, 99718, 99719, 99720, 99721, 99722, 99723, 99724, 99725, 99726, 99727, 99728, 99729, 99730, 99731, 99732, 99733, 99734, 99735, 99736, 99737, 99738, 99739, 99740, 99741, 99742, 99743, 99744, 99745, 99746, 99747, 99748, 99749, 99750, 99751, 99752, 99753, 99754, 99755, 99756, 99757, 99758, 99759, 99760, 99761, 99762, 99763, 99764, 99765, 99766, 99767, 99768, 99769, 99770, 99771, 99772, 99773, 99774, 99775, 99776, 99777, 99778, 99779, 99780, 99781, 99782, 99783, 99784, 99785, 99786, 99787, 99788, 99789, 99790, 99791, 99792, 99793, 99794, 99795, 99796, 99797, 99798, 99799, 99800, 99801, 99802, 99803, 99804, 99805, 99806, 99807, 99808, 99809, 99810, 99811, 99812, 99813, 99814, 99815, 99816, 99817, 99818, 99819, 99820, 99821, 99822, 99823, 99824, 99825, 99826, 99827, 99828, 99829, 99830, 99831, 99832, 99833, 99834, 99835, 99836, 99837, 99838, 99839, 99840, 99841, 99842, 99843, 99844, 99845, 99846, 99847, 99848, 99849, 99850, 99851, 99852, 99853, 99854, 99855, 99856, 99857, 99858, 99859, 99860, 99861, 99862, 99863, 99864, 99865, 99866, 99867, 99868, 99869, 99870, 99871, 99872, 99873, 99874, 99875, 99876, 99877, 99878, 99879, 99880, 99881, 99882, 99883, 99884, 99885, 99886, 99887, 99888, 99889, 99890, 99891, 99892, 99893, 99894, 99895, 99896, 99897, 99898, 99899, 99900, 99901, 99902, 99903, 99904, 99905, 99906, 99907, 99908, 99909, 99910, 99911, 99912, 99913, 99914, 99915, 99916, 99917, 99918, 99919, 99920, 99921, 99922, 99923, 99924, 99925, 99926, 99927, 99928, 99929, 99930, 99931, 99932, 99933, 99934, 99935, 99936, 99937, 99938, 99939, 99940, 99941, 99942, 99943, 99944, 99945, 99946, 99947, 99948, 99949, 99950, 99951, 99952, 99953, 99954, 99955, 99956, 99957, 99958, 99959, 99960, 99961, 99962, 99963, 99964, 99965, 99966, 99967, 99968, 99969, 99970, 99971, 99972, 99973, 99974, 99975, 99976, 99977, 99978, 99979, 99980, 99981, 99982, 99983, 99984, 99985, 99986, 99987, 99988, 99989, 99990, 99991, 99992, 99993, 99994, 99995, 99996, 99997, 99998]
Your code did not read or handle the input numbers properly.
Please view the raw input by clicking the button above the test cases:
How to solve it in bash can anyone help me?
It was discussed in this thread before. Search and check out the relevant discussion
I tried to write a c++ solver and it didn’t work on the long test, because I was using a custom-made sort function that was slower than the built-in one.
Then I realized… they were probably trying to make it so that inefficient sorters would break by putting them in more of a reverse order. So I reversed the order of the array before sorting, and it was fast enough to solve the puzzle.
Maybe add two “many horse” puzzles to prevent this?
I switched to c# and it works!
Can’t get my code to pass validators 5th and 6th even though I can pass all the IDE tests.
(passed all the other validators)
5th- all horses tie: I fixed my code to stop the moment difference between any two is 0 and return 0.
6th- Disorder horses: 2nd test in IDE is the same where horses are not in order and my code passed that test but not the validator.
Can anyone help??
Edit: nvm, fixed it. I’d suggest they add more IDE tests in this puzzle.