1. 程式人生 > >Codeforces Round 722C:Destroying Array(並查集,好題)

Codeforces Round 722C:Destroying Array(並查集,好題)

You are given an array consisting of n non-negative integers a1, a2, ..., an.

You are going to destroy integers in the array one by one. Thus, you are given the permutation of integers from 1 to n defining the order elements of the array are destroyed.

After each element is destroyed you have to find out the segment of the array, such that it contains no destroyed elements and the sum of its elements is maximum possible. The sum of elements in the empty segment is considered to be 0

.