A sequence of numbers is -balanced if the absolute value of the difference between any two consecutive numbers is at most . Formally is -balanced if for all it holds that .
Write a program that, given an integer and an integer , writes all -balanced sequences that can be obtained by reordering the sequence .
The input consists of an integer followed by another integer .
Write all -balanced sequences that can be obtained by reordering the sequence . You can write the sequences in any order.
Author: Albert Oliveras
Generation: 2026-01-25T15:56:08.268Z
© Jutge.org, 2006–2026.
https://jutge.org