#C13080. Two Sum Problem

    ID: 42579 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

Given an array of n integers and a target integer \(T\), your task is to find two distinct indices \(i\) and \(j\) (0-indexed) such that the sum of the elements at these indices is exactly \(T\). It is guaranteed that there is exactly one solution. You should output the two indices separated by a space.

Example:

Input:
4 9
2 7 11 15

Output: 0 1

</p>

The above example shows that \(2 + 7 = 9\), so the indices 0 and 1 form the correct answer.

inputFormat

The first line of input contains two integers (n) and (T), where (n) is the number of elements in the array and (T) is the target sum. The second line contains (n) space-separated integers representing the elements of the array.

outputFormat

Output two integers representing the indices of the two numbers that add up to (T). The indices should be separated by a single space.## sample

4 9
2 7 11 15
0 1

</p>