#C14672. Find the Triplet with Given Sum

    ID: 44347 Type: Default 1000ms 256MiB

Find the Triplet with Given Sum

Find the Triplet with Given Sum

Given a list of integers and a target sum (T), find a triplet ((a, b, c)) such that (a + b + c = T). If multiple valid triplets exist, you may output any one of them. If no such triplet can be found, output an empty tuple ( () ).

The triplet should be output in ascending order (i.e. (a \leq b \leq c)).

inputFormat

The input consists of three lines:
1. The first line contains an integer (n), the number of elements in the list.
2. The second line contains (n) space-separated integers representing the list elements.
3. The third line contains a single integer (T), the target sum.

outputFormat

If a valid triplet is found, output the three integers in ascending order separated by a space. Otherwise, output an empty tuple represented exactly as ( () ).## sample

6
1 2 3 4 5 6
10
1 3 6