531. Bonnie and Clyde
Time limit per test: 1.5
second(s)
Memory limit: 262144
kilobytes
input: standard
output: standard
Bonnie and Clyde are into robbing banks. This time their target is a town called Castle Rock. There are
n banks located along Castle Rock's main street; each bank is described by two positive integers
x_{i},
w_{i}, where
x_{i} represents the distance between the
ith bank and the beginning of the street and
w_{i} represents how much money the
ith bank has. The street can be represented as a straight line segment, that's why values of
x_{i} can be regarded as the banks' coordinates on some imaginary coordinate axis.
This time Bonnie and Clyde decided to split, they decided to rob two different banks at a time. As robberies aren't exactly rare in Castle Rock, Bonnie and Clyde hope that the police won't see the connection between the two robberies. To decrease the chance of their plan being discovered by the investigation, they decided that the distance between the two robbed banks should be no less than
d.
Help Bonnie and Clyde find two such banks, the distance between which is no less than
d and the sum of money in which is maximum.
Input
The first input line contains a pair of integers
n,
d (1 ≤
n ≤ 2 · 10
^{5}, 1 ≤
d ≤ 10
^{8}), where
n is the number of banks and
d is the minimum acceptable distance between the robberies. Then
n lines contain descriptions of banks, one per line. Each line contains two integers
x_{i},
w_{i} (1 ≤
x_{i},
w_{i} ≤ 10
^{8}),
x_{i} shows how far the
ith bank is from the beginning of the street and
w_{i} shows the number of money in the bank. Positions of no two banks coincide. The banks are given in the increasing order of
x_{i}.
Output
Print two integer numbers — indicies of the required banks. The banks are numbered starting from 1 in the order in which they follow in the input data. You may print indicies in any order. If there are many solutions, print any of them. If no such pair of banks exists, print "
1 1
" (without quotes).
Example(s)
sample input

sample output

6 3
1 1
3 5
4 8
6 4
10 3
11 2

5 3
