Author: | A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Consider a sequence of numbers a1,…,aN, representing heights. Let's say that element ai has a visibility radius d if ai≥aj for all j such that 1≤j≤N and |i−j|<d.
You task is to find maximum di for every ai.
Input file contains integer N followed by N integers ai.
Output file must contain N integers di — maximum visibility for every ai. If maximum visibility radius for element ai is unlimited, output di=0.
1≤N≤106, 0≤ai≤109
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|