CHEFRECP showing wrong answer

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

Anyone help me where this fails. I am not being able to figure out why this is giving wrong answer

Can you please add comments to your code to explain them a little.

Try to understand my logic without comments…

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

Thanks I got it. My mistake was I was not clearing map for each test case.
m.clear() It works now

1 Like