REtoAC2001's blog

By REtoAC2001, history, 2 years ago, In English

I used a recursive approach for the question 1625C solve(ll idx,ll last,ll cnt) where idx is the current index that we are presently at, last represents the last non removed sign and cnt is the number of removed signs up until now. I have used memoization but because of memory limit I couldn't use a 3d dp hence declared a 2d dp along with a map<pair<ll,ll>,ll> where the first part is idx*501+last(as last and idx<=500 hence idx*501 +last will represent a unique pair of {idx,last}) and the second part contains cnt. Whenever I get a result for some {idx,last,cnt}, I update the map accordingly. But I am getting WA on test 5 and I am unable to figure out why. Can anyone point out the flaw in my logic/implementation. Thanks is advance! Question Link : https://codeforces.com/contest/1625/problem/C Submission Link : https://codeforces.com/contest/1625/submission/142526100.

  • Vote: I like it
  • -3
  • Vote: I do not like it