#C3502. Two Sum Problem
Two Sum Problem
Two Sum Problem
You are given an array of integers and a target integer. Your task is to find two distinct indices \(i\) and \(j\) in the array such that the sum of the elements at those indices is equal to the target, i.e. \(a_i + a_j = target\). If there is no such pair, output -1.
The indices in the output should be zero-indexed, and if a valid pair exists, output the two indices separated by a space in the order they are discovered.
inputFormat
The input is read from standard input. The first line contains an integer \(n\), the number of elements in the array. The second line contains \(n\) space-separated integers representing the array elements. The third line contains a single integer representing the target sum.
outputFormat
Print the two indices that add up to the target, separated by a space. If no valid pair exists, print -1.
## sample4
2 7 11 15
9
0 1