Help with 2015 USP Try-outs problem F (Fighting Rajasi)

Revision en1, by prateep, 2016-07-22 03:39:11

http://codeforces.net/gym/101047/problem/F

I have been trying(unsuccessfully :-( ) to solve this problem for quite some time now. This is my attempt so far.

Initially, I sort the Rajasis in ascending order of their hit points, breaking ties with ones which give greater recovery points. Then, I am doing a bottom-up DP, with two states — position, no of spells remaining. dp[pos,sp] contains the minimum strength required to kill Rajasi at position "pos" using at most "sp" spells. Finally, if there is a valid configuration for pos=0, the answer is "Y", else "N". This approach gives WA on test #2.

Please help me figure out if my approach is wrong. Thanks for your help.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English prateep 2016-07-22 03:39:11 819 Initial revision (published)