Here, you have to efficiently keep a list of integer numbers, which is initially empty. Let the current list be . There are just two operations:
Given an integer and any position between 0 and , insert before the -th position (at the end, if ). That is, the new list must be .
Report the maximum sum of all the consecutive subsequences of the list.
Input consists of several cases. Every case begins with the number of
operations
,
followed by the
operations. We have an M for reporting the maximum, and
I
for inserting. Assume
,
,
and that
is between 0 and the current list size.
For every case, and for every M operation, print the
maximum sum of consecutive elements inside the current list. Print a
line with 10 dashes at the end of each case.
Author: Salvador Roura
Generation: 2026-01-25T12:04:46.789Z
© Jutge.org, 2006–2026.
https://jutge.org