AmazonOA #149
Find Ideal Days
估计中等可在线判题
A day is ideal only if the window adjacent relations before it, up to and including that day, are non-increasing, the window adjacent relations after it are non-decreasing, and the days on both sides exist. Output all such 1-based days. At least one ideal day is guaranteed.
输入格式
The first line contains n window, and the second line contains n forecast values. The source has 1≤window≤n≤200000, values in 0..10^9, and guarantees at least one solution, so the combined conditions actually require 2window+1≤n.
输出格式
Output all qualifying 1-based days in ascending order.
样例 1
输入:
6 2
3 2 2 2 3 4
输出:
3 4
样例 2
输入:
5 1
1 0 1 0 1
输出:
2 4
样例 3
输入:
10 3
1 1 1 1 1 1 1 1 1 1
输出:
4 5 6 7
样例说明
Example 1: days 3 and 4 each have two steps before and after that satisfy the relations, so output 3 4. Example 2: the two valleys are days 2 and 4. Example 3: all relations are equal, so days 4, 5, 6 and 7, which have three days on each side, can all be chosen.