Suffix Minima
For every position print the minimum of ai..N.
Input: the first line has N; the second line has N integers.
Output: N integers: the minimum from each position to the end.
Constraints:
- 1 ≤ N ≤ 105
- -10000 ≤ ai ≤ 10000
Sample Tests
Input 1
4 2 1 5 3
Output 1
1 1 3 3
Input 2
1 9
Output 2
9
Discussion (opens after you solve — no spoilers before)
No comments yet.