#C8657. Find Pair with Given Sum

    ID: 52663 Type: Default 1000ms 256MiB

Find Pair with Given Sum

Find Pair with Given Sum

You are given an array of n integers and a target integer \( T \). Your task is to find two distinct indices \( i \) and \( j \) (1-based) such that:

[ a_i + a_j = T ]

If such a pair exists, output the two indices separated by a space. If there are multiple solutions, you may output any one of them. If no such pair exists, output -1.

Note: The array indices are 1-based.

inputFormat

The input is given from stdin in 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 array.
  3. The third line contains the target integer \( T \).

outputFormat

Output the indices of the two numbers that add up to the target, separated by a space. If no such pair exists, output -1. The output should be printed to stdout.

## sample
5
2 7 11 15 3
9
1 2

</p>