eolymp
bolt
Try our new interface for solving problems
Problems

Sum of three

Sum of three

Given an array of integers $A$ and an integer $x$. Find a triplet of numbers $(A_i, A_j, A_k)$ in the array whose sum equals $x$. All indices $i, j, k$ should be different. \InputFile The first line contains the size of the array $n~(n \le 3 \cdot 10^4)$ and the value of $x~(|x| \le 10^9)$. The second line contains $n$ integers, each of which does not exceed $10^8$ in absolute value. \OutputFile If the required triplet exists, print it in any order. If multiple triplets exist, print any one of them. If the desired triplet does not exist, print $-1$.
Time limit 1 second
Memory limit 128 MiB
Input example #1
8 19
20 3 5 1 15 7 17 12
Output example #1
1 3 15
Author Michael Medvediev