From a53c4128c29f98b5fdfd9b0e13a3bbe094d975ec Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Sun, 19 Feb 2017 11:37:07 +0700 Subject: Update others/volume1 --- others/volume1/075.pas | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 others/volume1/075.pas (limited to 'others/volume1/075.pas') diff --git a/others/volume1/075.pas b/others/volume1/075.pas new file mode 100644 index 0000000..1ccacaf --- /dev/null +++ b/others/volume1/075.pas @@ -0,0 +1,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. -- cgit 1.4.1