AtCoder Regular Contest 185
C
Sum of Three Integers
AtCoder
⌀ 2242
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given an integer sequence $A = (A_1, A_2, \dots, A_N)$ and an integer $X$. Print one triple of integers $(i, j, k)$ satisfying all of the following conditions. If no such triple exists, report that fact.

翻译中…
  • $1 \leq i \lt j \lt k \leq N$
  • $A_i + A_j + A_k = X$
翻译中…

Constraints

翻译中…
  • $3 \leq N \leq 10^6$
  • $1 \leq X \leq 10^6$
  • $1 \leq A_i \leq X$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N X
A_1 A_2 \dots A_N

翻译中…

Output

翻译中…

If there exists an integer triple $(i, j, k)$ satisfying the conditions, print one in the following format. If there are multiple solutions, you may print any of them.

翻译中…

i j k

翻译中…

If no such triple exists, print -1.

翻译中…

样例

Input #1
5 16
1 8 5 10 13
Output #1
1 3 4
The triple $(i, j, k) = (1, 3, 4)$ satisfies $1 \leq i \lt j \lt k \leq N$ and $A_i + A_j + A_k = 1 + 5 + 10 = 16 = X$.
Input #2
5 20
1 8 5 10 13
Output #2
-1
Input #3
10 100000
73766 47718 74148 49218 76721 31902 21994 18880 29598 98917
Output #3
4 6 8
题目信息
题号
arc185_c
时间限制
3 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。