Can't find error in my solution for 1625C

Правка en1, от REtoAC2001, 2022-01-12 18:21:09

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.

Теги round #765

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский REtoAC2001 2022-01-12 18:21:09 924 Initial revision (published)