#C4136. Two Sum

    ID: 47641 Type: Default 1000ms 256MiB

Two Sum

Two Sum

Given an array of integers and a target integer T, find two distinct numbers a and b such that they satisfy the equation $$a + b = T$$. If multiple pairs exist, you may output any one of them. The solution should read input from stdin and write the answer to stdout.

inputFormat

The input consists of three lines:

  • 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 an integer T, the target sum.

outputFormat

Output two integers separated by a space which add up to T. If no valid pair exists, output -1.

## sample
4
2 7 11 15
9
2 7