Three That Sum to T
Do three DIFFERENT positions exist with ai + aj + ak = T?
Input: the first line has N and T; the second line has N integers.
Output: YES or NO.
Constraints:
- 3 ≤ N ≤ 2000
- |ai|, |T| ≤ 109
Sample Tests
Input 1
5 9 2 7 4 1 5
Output 1
NO
Input 2
3 100 1 2 3
Output 2
NO
Discussion (opens after you solve — no spoilers before)
No comments yet.