#C14276. Two Sum Problem

    ID: 43907 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

Given an array of integers and a target integer \(T\), your task is to find two distinct indices \(i\) and \(j\) such that the sum of the elements at these indices is equal to \(T\), i.e., \(a_i + a_j = T\). It is guaranteed that there is exactly one solution.

Note: Each input will have exactly one solution, and you may not use the same element twice.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains an integer \(n\), the number of elements in the array.
  2. The second line contains \(n\) space-separated integers representing the elements of the array.
  3. The third line contains an integer \(T\), the target sum value.

outputFormat

Output to standard output (stdout) two integers separated by a space: the indices of the two numbers that add up to \(T\).

## sample
4
2 7 11 15
9
0 1