#C3781. Two Sum Problem

    ID: 47246 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

Given an array of integers and a target integer (T), find two distinct indices (i) and (j) (with (i < j)) such that the sum of the elements at these indices equals (T), i.e. (a_i + a_j = T). It is guaranteed that exactly one solution exists for each test case. This problem tests your knowledge of hash tables (or alternative methods) to achieve an efficient solution.

inputFormat

The input is given via standard input (stdin). 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 (T) representing the target sum.

outputFormat

Print two space-separated integers on a single line, representing the indices of the two numbers such that their sum equals (T).## sample

4
2 7 11 15
9
0 1