Comments
On i.eCodeforces Round #669, 6 years ago
0

Always being a tough too solve a interactive problem

On i.eCodeforces Round #669, 6 years ago
0

Nice Problems

On i.eCodeforces Round #669, 6 years ago
0

to learn more about interactive problem see the question of long contest in codechef that always have 1 interactive problem.

On i.eCodeforces Round #669, 6 years ago
+15

those problems in which the code interacts with the in real time. When we develop a solution for an Interactive Problem then the input data given to our solution may not be predetermined but is built for that problem specifically. The solution performs a series of exchange of data with the judge and at the end of the conversation the judge decides whether our solution was correct or not.

create a array "ans" of size n and intialise it to 0. and also define a map<int,int>mp iterate form 0 to n if the value of a[i]-i not exist in map then ans[i] updated to a[i] and if it exist then update the value of ans[i]=a[i]+ans[mp[a[i]-i]. and also update mp[i]=a[i]-i every time Now print the maximum value of ans.