#C3828. Two Sum Problem

    ID: 47298 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

Given an array of integers and a target integer, your task is to find the two distinct indices such that the corresponding elements add up to the target value. Each test case is guaranteed to have exactly one solution, and you cannot use the same element twice.

Mathematically, find indices \(i\) and \(j\) such that \(a_i + a_j = target\) and \(i \neq j\).

inputFormat

The first line contains an integer n, representing the number of elements in the array. The second line contains n space-separated integers. The third line contains an integer representing the target sum.

outputFormat

Output two space-separated integers representing the indices (0-indexed) of the two numbers that add up to the target.## sample

4
2 7 11 15
9
0 1

</p>