Under construction

Still being built. Things may change

Attacking Pairs

Interview

Time limit2sMemory limit1024 MB

Summary
Given n strengths, find any pair of creatures within index distance k whose strength difference lies in [l, r], or report -1 -1 if none exists.
Level

Medium6 of 10

Topics
Sliding window, Binary search, Sorting
Solved
No attempts yet

Statement

Underwater world is in hard times, and a war has broken out. Aquaman gathered his army of nn different creatures, lined them up, and numbered them from 11 to nn. The ii-th creature has strength aia_i.

Aquaman learned the following fighting technique from his mother: pairs of creatures are sent into battle, strike a precise blow on the enemy army, and then immediately return to their places in the line. Not every pair can be sent, though. Only pairs of creatures 1≤i,j≤n1 \le i, j \le n that satisfy

{1≤∣i−j∣≤kl≤∣ai−aj∣≤r\begin{cases} 1 \le |i - j| \le k \\ l \le |a_i - a_j| \le r \end{cases}

are suitable.

To begin, to see whether his army has any chance of winning, Aquaman wants to find any pair of creatures that can be sent into battle. Help him.

Input

The first line contains four integers nn, kk, ll, rr: the number of creatures in Aquaman's army, and the limits on ∣i−j∣|i - j| and ∣ai−aj∣|a_i - a_j| respectively (2≤n≤1052 \le n \le 10^5, 1≤k<n1 \le k < n, 0≤l≤r≤1090 \le l \le r \le 10^9).

The second line contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n, the strengths of the creatures (1≤ai≤1091 \le a_i \le 10^9).

Output

If a pair of creatures that can be sent exists, print the two indices ii and jj on a single line. If several pairs are possible, print any of them. If no such pair exists, print −1-1 and −1-1 on a single line.

Hint

In the first example, Aquaman has only one pair that can be sent into battle: a3=6a_3 = 6 and a5=4a_5 = 4, since 1≤∣3−5∣≤21 \le |3 - 5| \le 2 and 2≤∣6−4∣≤32 \le |6 - 4| \le 3.

In the second example, a pair can be sent only if the strengths are equal, but the array has no two equal elements.

Examples2

  1. Example 1

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

    Input
    5 2 0 0
    2 1 6 5 4
    
    Expected output
    -1 -1