Need help with NUKES

https://www.codechef.com/viewsolution/19952275

Getting the test case correct, any more ideas for testcases that is not matching my logic? I can’t figure it out.

Several problems with that code. I suggest you create a couple of tables of test cases for different particle (A) values for a fixed system - for example, with input like “A 2 3”:

A    output
0    0 0 0
1    1 0 0
2    2 0 0
3    0 1 0
4    1 1 0
5    2 1 0
6    0 2 0
7    1 2 0
8    2 2 0
9    0 0 1
10   1 0 1

etc. That should give you some ideas.

1 Like

@joffan I got the logic. This seems to be much more arithmetic than my plain mechanical solution and is much more efficient as well. Thanks a lot for pointing it out. I would still want to implement it mechanically sometime but I suspect a few TLEs will be in order.

Yes, you already had TLEs in a couple of cases from the modelling version. But you were lucky not to have run-time errors - your incrementing bug meant you didn’t find your bug accessing beyond end of array.