#C8689. Two Sum Problem

    ID: 52698 Type: Default 1000ms 256MiB

Two Sum Problem

Two Sum Problem

You are given a list of integers and a target integer. Your task is to determine the indices of the two numbers in the list that add up to the target.

There is exactly one solution, and you cannot use the same element twice.

Formally, given an array \(A\) of integers and an integer \(T\), find indices \(i\) and \(j\) such that \[ A[i] + A[j] = T \] with \(i \neq j\). It is guaranteed that a unique solution exists.

inputFormat

The input is provided via standard input (stdin) and consists of two lines. The first line contains space-separated integers representing the array elements. The second line contains a single integer representing the target value.

outputFormat

Print the indices of the two numbers that add up to the target, separated by a space, to standard output (stdout).## sample

2 7 11 15
9
0 1