ash_vs_ash's blog

By ash_vs_ash, history, 7 years ago, In English

I was trying to solve this problem on Codechef, " https://www.codechef.com/ICOP1904/problems/GRP ". I understand that I have to use DP to solve it and also that I have to maintain two states, but I am unable to figure out how to proceed to solve it. I even looked at some submissions but I am still not sure if I got it completely. Can someone please explain me how to solve the problem. Thanks in advance..

Tags #dp
  • Vote: I like it
  • -18
  • Vote: I do not like it

»
7 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I was trying out this problem and i am getting WA.I have thought about the dp states and tried some test cases too and i cant find my mistake.If anyone could point out some mistake in my code it would be of great help!! Link to my solution https://ideone.com/lcUUTo .Kindly open the code in your local text editor so that the comments would be readable.Thanks in advance!!

»
7 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it