atcoder#ARC152C. [ARC152C] Pivot
[ARC152C] Pivot
Score : points
Problem Statement
We have a sequence of terms: . You can perform the following operation on this sequence any number of times (possibly zero).
- Choose a term of the sequence at that point, and let be its value. Then, for every , replace with . However, this operation may not be performed in a way that produces a term with a negative value.
You want to make the greatest value among the terms of the sequence as small as possible. What will this value be after an optimal sequence of operations for this objective?
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
3
1 3 6
5
If you perform the operation with , the sequence becomes . The greatest value here is . Under the condition that there may not be a term with a negative value, the greatest value among the terms of the sequence cannot be made smaller, so you should print .
5
400 500 600 700 800
400
To obtain this result, perform the operation once with , or perform it with and then with , for instance.