Overshadowed Trees

Time limit1sMemory limit1024 MB

Summary
For each tree, check whether any taller tree within K positions exceeds its height by at least M, and list all such trees.
Level

Medium4 of 10

Topics
Sliding window, Array, Brute force, Implementation
Solved
No attempts yet

Problem

Forester Linas takes care of a forest with NN trees. All the trees are planted on a single straight line, and the distance between any two adjacent trees is always 1 meter.

Linas dislikes that some trees are "overshadowed" by others, so he wants to fertilize the overshadowed trees to help them grow better. The ii-th tree is overshadowed if the tallest other tree growing within a radius of KK meters around it is taller than its own height hih_i by at least MM.

For example, consider N=6N = 6, K=1K = 1, M=2M = 2 with tree heights 1,2,4,3,1,11, 2, 4, 3, 1, 1 in order.

Overshadowed trees example

  • Tree 5 is overshadowed. Within distance K=1K = 1 there are two trees (tree 4 and tree 6). The difference between the taller tree 4's height (33) and tree 5's height (11) is 22, which is at least M=2M = 2.
  • Tree 6 is not overshadowed. Within distance K=1K = 1 there is only tree 5. The difference between their heights is 00, which is not at least M=2M = 2.

Find all overshadowed trees.

Input

The first line contains three space-separated integers NN, KK, and MM: the number of trees, the radius Linas inspects, and the height-difference threshold, respectively.

The second line contains NN space-separated integers hih_i, the heights of the trees.

Output

On the first line, print a single integer: the number of overshadowed trees in Linas's forest. On the second line, print the numbers of the overshadowed trees in increasing order (from the smallest to the largest), separated by spaces. If there are no overshadowed trees, print 00 on the first line and leave the second line empty.

Constraints

  • 1≤N,K,M,hi≤2000001 \le N, K, M, h_i \le 200000 (1≤i≤N1 \le i \le N)

Examples1

  1. Example 1

    Input
    6 1 2
    1 2 4 3 1 1
    
    Expected output
    2
    2 5