A sequence of numbers has a well if it contains three consecutive numbers such that the endpoints add up more than twice the one in the middle. Formally, has a well if it exists at least an with such that .
Write a program that, given an integer , prints all the sequences with no wells that can be obtained by reordering the sequence .
Input consists of several cases, each one with an between 1 and .
For every , print all the permutations with no wells in lexicographical order. Print a line with 10 dashes at the end of every case.
Author: Albert Oliveras
Generation: 2026-01-25T11:13:59.192Z
© Jutge.org, 2006–2026.
https://jutge.org