AyanoGod's blog

By AyanoGod, history, 4 years ago, In English

Is there any tool that fetches problems solved by a handle Rating-Wise? Like one has to input handle and rating and the tool will show up appropriate problems.

PS: Tried searching but didn't found one!!

Full text and comments »

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

By AyanoGod, 4 years ago, In English

Hello, Hope you are doing well.

Problem link: https://codeforces.me/problemset/problem/1373/D Author's Editorial: https://codeforces.me/blog/entry/79376

According to the Author, we should use 2d DP but I am having a hard time understanding how and why these works.

"State of our dynamic programming is dpi,j where i∈[0;n] and j∈[0;2]. dpi,0 denotes the answer on the prefix of length I if we didn't start reversing the subarray, dpi,1 denotes the answer if we started reversing the subarray but didn't end it and dpi,2

denotes the answer if we ended reversing the subarray. Transitions are pretty easy:"

dpi+1,0=max(dpi+1,0,dpi,0+[i%2==0?ai:0]);

dpi+2,1=max(dpi+2,1,max(dpi,0,dpi,1)+[i%2==0?ai+1:ai]);

dpi+1,2=max(dpi+1,2,max(dpi,0,dpi,1,dpi,2)+[i%2==0?ai:0])

Please help me with how and why this works also how are we making sure that we don't reverse the array more than once?

PS: I have already searched and commented on editorial blog but no help from there.

Full text and comments »

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