#C14734. Two Number Sum

    ID: 44416 Type: Default 1000ms 256MiB

Two Number Sum

Two Number Sum

You are given an array of distinct integers and a target sum \(T\). Your task is to find any two numbers in the array that add up to \(T\). If such a pair exists, output the two numbers (order does not matter). Otherwise, output an empty array [].

Example:

Input:
8
3 5 -4 8 11 1 -1 6
10

Output: 11 -1

</p>

Note: The formula for the target calculation is \(a + b = T\), where \(a\) and \(b\) are two distinct numbers from the array.

inputFormat

The input is given from standard input (stdin) and has three parts:

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

outputFormat

Output to standard output (stdout). If a valid pair is found, print the two integers separated by a space. Otherwise, print an empty array as '[]'.## sample

8
3 5 -4 8 11 1 -1 6
10
11 -1