CSES Problemset/Sorting and Searching
Sum of Two Values
#1640Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopYou are given an array of integers, and your task is to find two values (at distinct positions) whose sum is .
Input
The first input line has two integers and : the array size and the target sum.
The second line has integers : the array values.
Output
Print two integers: the positions of the values. If there are several solutions, you may print any of them. If there are no solutions, print IMPOSSIBLE.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
4 8 2 7 5 1
Expected Output
2 4
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
4 8 2 7 5 1
Expected Output
2 4