about summary refs log tree commit diff
path: root/others/volume1/075.pas
blob: 1ccacafc12b0cb0cbab77d6a943c0347eeba5fe8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
uses clib;

var
  n, idx, i, j: int16;
  a, b: array of int64;
  k: int64;

begin
  readln(n, k);
  setlength(a, n);
  setlength(b, n);
  for i := 0 to n - 1 do
    begin
      read(a[i]);
      b[i] := a[i]
    end;
  qsort(b);
  for i := 0 to n - 1 do
    begin
      idx := bsearch(b, a[i] + k);
      if idx > -1 then
        for j := 0 to n - 1 do
          if a[j] = b[idx] then
            begin
              writeln('YES'#10, i + 1, ' ', j + 1);
              exit
            end
    end;
  writeln('NO')
end.