Блог пользователя ash_vs_ash

Автор ash_vs_ash, история, 5 лет назад, По-английски

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..

Теги #dp
  • Проголосовать: нравится
  • -18
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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!!

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится