AtCoder DP Help (K-Stones)

Revision en1, by CodeSherlock, 2020-08-12 12:02:52

Hey Programmers, Hope you all are safe and doing well.

I am a beginner in DP, and while solving the atcoder dp series, Problem K (Stones) , I am not able to pass all sets of test cases. Also this I am not able to analyse whether its a DP or greedy problem.

Here is My Solution :.

My Logic : If we can reduce the no.of stones(k) to something where the opponent cannot make a next move, I win. Else I simply reduce the min no. (mn) of the given array from the no.of stones.

Can you please clear my confusion ? It will be helpful if you can point out the test case...where my solution goes wrong. Thank You.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English CodeSherlock 2020-08-12 12:02:52 748 Initial revision (published)