Chef and Modulo Game

Can anyone tell in the given test cases like 4 4 .why we didn’t use pair (1,2,1)or(2,1,1),etc .As from these ones we get M=2 rather than M=1;

I solved this question for 100 points, however I had a wrong calculation on an edge case. I think the test cases are weak.

As I tested,the wrong calculation on an edge case is included in the question. I think the test cases may be wrong. I don’t want to explain further because it may suggest solution to other people so I would like to talk to the author by email. If you can please email me at

1 Like

for n=4 and p=4 if you use any of the pair(1,2,1) or(2,1,1) the value of M you will get is 0 not 2

Don’t ask questions about on going contest on discuss… If you need clarification then Ask in comments section below problem statement… you query will be answered if question is relevant

Let’s talk on codeforces personal messages ? My handle smit_mandavia

Hi, please discard my comment above, I was actually overthinking and realize that everything runs perfect :slight_smile:
Sorry for the question :slight_smile:

Okay np…

*Don’t forget to mention that you are problem writer of this problem.

Yes I am the author of this problem