#C3956. Check Pair Difference
Check Pair Difference
Check Pair Difference
Given an array of integers and an integer target, determine whether there exists a pair of distinct elements in the array such that the absolute difference between them equals the target. In other words, you need to check if there exist two indices \(i\) and \(j\) (with \(i \neq j\)) for which the following holds:
\[|a_i - a_j| = |T|\]
where \(T\) is the target integer. Note that the target value may be negative; however, the condition uses the absolute difference.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer (n), denoting the size of the array.
- The second line contains (n) space-separated integers representing the elements of the array.
- The third line contains a single integer (T), the target value.
outputFormat
Output to standard output (stdout) a single line with the string "Yes" if there exists a pair of distinct indices such that the absolute difference of the corresponding array elements is equal to (|T|), or "No" if no such pair exists.## sample
6
5 20 3 2 50 80
78
Yes