#K92102. Pair With Smallest Product

    ID: 38123 Type: Default 1000ms 256MiB

Pair With Smallest Product

Pair With Smallest Product

You are given an array of integers \(a_0, a_1, \dots, a_{n-1}\) and an integer target \(T\). Your task is to find a pair of distinct elements \(a_i\) and \(a_j\) such that:

\[ a_i + a_j = T \]

If there are multiple valid pairs, choose the pair for which the product \(a_i \times a_j\) is the smallest. If no such pair exists, return an empty output.

Note: The pair should be printed in the order as they appear in the array.

inputFormat

The first line contains an integer \(n\) denoting the number of elements in the array. The second line contains \(n\) space-separated integers representing the array. The third line contains an integer \(T\) representing the target sum.

outputFormat

If a valid pair is found, print the two integers separated by a space. If no such pair exists, print an empty line.

## sample
5
1 2 3 4 6
5
1 4