Sum of Three Integers

AtCoder
IDarc185_c
Time3000ms
Memory256MB
Difficulty
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$ [samples]
Samples
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
API Response (JSON)
{
  "problem": {
    "name": "Sum of Three Integers",
    "description": {
      "content": "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, repo",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc185_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given an integer sequence $A = (A_1, A_2, \\dots, A_N)$ and an integer $X$.  \nPrint one triple of integers $(i, j, k)$ satisfying all of the following conditions. If no such triple exists, repo...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments