#K33192. Pair with Difference

    ID: 25033 Type: Default 1000ms 256MiB

Pair with Difference

Pair with Difference

You are given an array of integers and a target integer \(t\). Your task is to determine whether there exist two distinct indices \(i\) and \(j\) such that the absolute difference between arr[i] and arr[j] is exactly \(t\), i.e., \(|arr[i] - arr[j]| = t\).

Note: The order of the numbers does not matter, and the pair should consist of two different indices (although the values may be the same). For example, when t = 0, the problem reduces to checking whether there is any duplicate in the array.

inputFormat

The input is given via standard input (stdin) and has the following format:

  1. The first line contains two space-separated integers: n (the size of the array) and t (the target difference).
  2. The second line contains n space-separated integers representing the elements of the array.

outputFormat

Print to standard output (stdout) True if there exists at least one pair of distinct indices satisfying \(|arr[i] - arr[j]| = t\). Otherwise, print False.

## sample
4 4
1 5 9 13
True