I am referring to problem- https://codeforces.net/problemset/problem/1067/A. I did refer to the editorial for this problem and well, it is really hard to understand. I do get the overall sketch of the solution but there are a few ambiguities in the language of the editorial- https://codeforces.net/blog/entry/62688. I still got no idea what "flag" state is doing in dp. Perhaps the editorial writer wanted to say(i am using the same notation as used in the editorial) "flag=0 when the a[prefix-1]<=a[prefix] " or something like that. Can anyone help me figure out what exactly the editorial wants to say? I will be really thankful. I know it is kinda ..............frustrating to go through a problem statement and then the editorial to try and understand what I am trying to ask. But both the problem statement and editorial for the problem won't take too long to read. Thank you