Game information:
Timeout: the program did not provide 1 input lines in due time…
![]()
I have no more ideas
Game information:
Timeout: the program did not provide 1 input lines in due time…
![]()
I have no more ideas
Hint: Memoization
Typical stackoverflow post: I’ve a problem… NVM. And no information on how he solved it ![]()
I’ve the same problem, I’m reading the description again and again but nothing come to mind for the moment…
@DuvalValentin, did you find the cause? I have exactly the same as you (finding 144), and at the moment I don’t know how to debug.
Sure. (spoilers ahead)
I used caching to remember the final result for each intermediate game state.
But my mistake was to only use the dices state as the key for the cache. To fix it I used both the dices state and the turn number (current “depth”) as the key.
Ok, regarding this problem (only getting 144 paths and 10 unique final states at case 5): it had to do with rule interpretation. Let me put it behind spoiler tags - although I personally would say it is not a spoiler to add rule interpretations, and I would have liked it if this detail would have been tested in a smaller case first (because debugging is hell if you don’t know which paths you are missing).
It had to do with the rule
Captures are mandatory when placing a die where a capture is possible.
I interpreted this as ‘capture whenever it is possible’ – like in checkers. But that is technically not what it says; it says that whenever you place a die on a position that would capture two or more other dice, you must capture (remove at least two of those dice).
In other words, after the following state:
6 0 6
0 1 0
6 0 5
You can capture →
6 0 6
0 0 6
6 0 0
but you are also allowed to take a non-capturing move → eg
6 0 6
1 1 0
6 0 5
I am using Java and while solving tests 11 and 12, sometimes it works and sometimes it times out. When I use System.currentTimeMillis to get duration, my solution takes effectively around 10 seconds (sometimes less, sometimes more). When it takes less than 10 seconds my output is OK, else I get a timeout.
For those use cases, timeout is supposed to be 30 and 40 seconds, could you please check that your platform is well configured or change the constraints chapter in the rules. This prevents me to have 100% score when I submit my solution.
Thanks in advance,
The 30/40 second timeouts likely refer to the two last validation instances used to calculate the scoreboard and not to the public test cases in the web IDE. These two validation instances are FYI even more fiendish than public test cases 11 & 12, so get your code in shape …
Wow that was a sneaky sneaky bug, I had the same problem indeed.
Thank you for your help (and for saving me another 8 hours of debugging ^^')
Nice gold medal : 0 ms. It’s going to be hard to do better ![]()
When I run a single-threaded solution, it takes some time to execute. Specifically, I have a simple loop iterating over 40,353,607 elements. To speed things up, I decided to split the workload across multiple threads. On my PC, which has 16 CPU cores, this significantly improves execution time—approximately by an order of magnitude, which aligns with my hardware.
I checked the number of CPUs available on the machines running tests on CodinGame, and it shows 8 CPUs. However, when I submit my multithreaded solution to CodinGame, it actually runs slower—sometimes even causing test timeouts, whereas the single-threaded loop completes successfully.
Could you please explain why this occurs? I’m using C and the pthread library.
Unfortunately we only get one core on coding game…
Seems like the organizers did not foresee some loopholes, and unless they change something (1) the leaderboard will be topped by hundreds of 0ms C++ and Rust solutions.
As it seems (maybe I am wrong about how the 0ms is achieved) it is a competition of how fast you submit an exploit for a loophole (using one of very few languages), rather than how to write fast code.
(1) Something, could be enforcing the smallish, but still official memory limits – or better, adopting a more … holistic … measure of solution time.
A bug in my possible move detection.
Problem was with state 616_106_610
It has 5 moves, but I was exiting from 2-neighbor combos without trying the 3-neighbor kind.
One such loophole is hardcoding the solution - which you can absolutely exploit using any language, not just Rust or C++. However, having a fast “normal” solution available makes it easier to figure out what solution to hardcode. Hint: You can’t just hardcode the solution for the example test-cases, as the validators are different, but it’s not actually that difficult to figure out what the validators are.
However, a hardcoded solution will not help you with the final evaluation tests, which are going to be different again. As the problem statement currently says, the final rank will be based on the average of the validator score and the final evaluation score, so as it stands, it’s still beneficial to submit a hardcoded solution. I would expect the organisers to revert that decision and only use the final evaluation score, given that it somewhat defeats the game.
Hats off nonetheless to @DepartmentOfRedundancy to first demonstrate the feasibility of determining the validators.
That’s not what it says. It means you’ll have two versions of your code run against the completely unknown ranking validators; the one that did best against the in-contest validators, and whichever one you submitted last. They implemented this during the last optimisation contest to avoid penalising anyone who’d over-fitted to the in-contest validators (potentially just by spamming submit a bit). It could be clearer but I believe it’ll be the best of these two scores, not the average.
I am missing some validators to give n00bs like me (with Python) at least some score. Within my skillset I have made multiple steps, to get code that initially worked only for test cases up to 4, working for 5 and finally 6. All of that still times out at all validators. I would like to compare my n00b skills + Python with others in the same range, rather than getting simply 0%. For example, completing test case 5 with an earlier version of my code in 20, and now in 0 ms, is some improvement that I would like to see compared with others having limited skills and using Python.
That would probably motivate more participants to submit their code - and have some meaningful comparison also in the lower range of the score board.
The loophole I have in mind is not exploitable in all languages on CG platform. For example it is not possible to do it in C given CG:s environment. Maybe I am wrong how it is done, and I am happy to admit being wrong if someone submits a 0ms C solution.
To determine the answers to validators for trolling purposes is easy, submit 30 times and deliberately fail a problem if a bit is set/not set in the answer.
The “rules exploit” I have in mind works for any input.
Now I’m really curious what kind of loophole you have in mind that is supposed to work for C++ but not for C. In the old days, C++ was actually translated into C before being compiled by a C compiler, which guarantees that C, at least in theory could do everything C++ could do. Of course, these days are over, and while the C++ compiler provided in this environment is embarrassingly old, it’s not that old. Then, code size limits my affect the two languages differently, and of course C++ offers more functionality through its standard library. Still, I have a hard time imagining something doable in C++ that you wouldn’t be able to pull off in C.
On the other hand, I’m not going to submit a hardcoded 0ms C solution just to prove that that is possible - I don’t want to get disqualified
.
Ah right, that makes more sense. I have to admit, I didn’t read that part too carefully, (I don’t intend to exploit the ranking system).