#C7243. Two Sum Problem

    ID: 51093 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

You are given an array of integers \(A\) and an integer target \(T\). Your task is to find two distinct indices \(i\) and \(j\) in the array such that:

\(A[i] + A[j] = T\)

It is guaranteed that there is exactly one solution, and you may not use the same element twice.

Note: The indices should be output as two space-separated integers.

inputFormat

The input consists of three lines:

  • The first line contains an integer \(n\) representing the number of elements in the array.
  • The second line contains \(n\) space-separated integers representing the array \(A\).
  • The third line contains an integer \(T\) representing the target sum.

outputFormat

Output two space-separated integers representing the indices of the two numbers in the array which add up to \(T\). It is guaranteed that exactly one solution exists.

## sample
4
2 7 11 15
9
0 1