REtoAC2001's blog

By REtoAC2001, history, 3 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.me/contest/1625/problem/C Submission Link : https://codeforces.me/contest/1625/submission/142526100.

Full text and comments »

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

By REtoAC2001, history, 3 years ago, In English

In yesterday's div-3 (Round #756) I got WA on test 2 in problem C when I submitted it in GNU C++ 14 and now the same code gives AC when I submitted it in GNU C++ 17 (64 bit). Can anyone explain why this is happening? Link to Submission: WA Code(C++ 14) : https://codeforces.me/contest/1611/submission/136859793. AC Code(C++ 17-64 bit) : https://codeforces.me/contest/1611/submission/136967042. Both the codes are exactly same .

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By REtoAC2001, history, 3 years ago, In English

While writing a recursive solution to the problem https://codeforces.me/contest/1389/problem/B I didn't take count (which is the number of steps taken till now) into account in the dp states. But now that I think of it ,I wonder why doesn't the dp(recursion) depend on the no of steps left.
Here is the link to my submission :https://codeforces.me/contest/1389/submission/122378801. Here idx represents the present index we are currently in, check denotes whether the last move was left(1) or right(0) and mleft is count of moves to the left we have taken so far. Can anyone help me understand why is it independent on the no of steps taken/left.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it