#C5221. Find a Pair with a Given Sum

    ID: 48847 Type: Default 1000ms 256MiB

Find a Pair with a Given Sum

Find a Pair with a Given Sum

You are given an array of n integers and an integer target T. Your task is to determine whether there exists a pair of distinct elements in the array such that their sum is equal to T. In mathematical notation, given an array \(a_1, a_2, \ldots, a_n\) and a target \(T\), you need to find two indices \(i\) and \(j\) (with \(i \neq j\)) satisfying:

[ a_i + a_j = T ]

If such a pair exists, output the pair. If there are multiple valid pairs, you may output any one of them. If no such pair exists, output None.

Note: The input is provided via standard input (stdin) and the output must be printed to standard output (stdout).

inputFormat

The input consists of three lines:

  1. An integer n representing the number of elements in the array.
  2. A line with n space-separated integers representing the array.
  3. An integer representing the target sum T.

If n is 0, the second line may be empty.

outputFormat

If a pair exists, output the two integers separated by a space in one line. If no valid pair exists, output None (without quotes).

## sample
4
2 7 11 15
9
7 2