#K40522. Find Pair Indices

    ID: 26661 Type: Default 1000ms 256MiB

Find Pair Indices

Find Pair Indices

Given an array of integers and a target sum \( k \), find the indices of the two numbers that add up exactly to \( k \). There is exactly one solution for each test case, and you may not use the same element twice.

For example, if the input array is [2, 7, 11, 15] and \( k = 9 \), then the answer is [0, 1] because \( 2 + 7 = 9 \).

inputFormat

The first line contains an integer \( n \), denoting the number of elements in the array.

The second line contains \( n \) space-separated integers representing the elements of the array.

The third line contains an integer \( k \), the target sum.

outputFormat

Output two integers separated by a space, representing the indices of the two numbers whose sum is equal to \( k \>.

## sample
4
2 7 11 15
9
0 1