You have different numbers. Write a program to find all the ways to put the numbers in two rows and so that:
,
,
for every , it holds .
Input consists of , followed by different integer numbers. Assume .
Print all the ways to put the numbers fulfilling the required conditions. For every way, print three lines: two rows with and separated by spaces, and an empty line. Print the solutions in lexicographical order: first, those with the smaller , in case of a tie, those with the smaller , …, in case of a tie, those with the smaller , in case of a tie, those with the smaller , …
Author: Unknown
Translator: Salvador Roura
Generation: 2026-01-25T12:00:39.323Z
© Jutge.org, 2006–2026.
https://jutge.org