#abc277h. Ex - Constrained Sums
Ex - Constrained Sums
Score : points
问题描述
判断是否存在一个包含 个整数的序列 ,满足所有以下条件,并在存在时构建这样一个序列。
-
对于每个 ,有 。
-
对于每个 ,满足不等式 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Determine whether there is a sequence of integers that satisfies all of the following conditions, and construct one such sequence if it exists.
-
for every .
-
for every .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
If there is an integer sequence that satisfies all of the conditions in the Problem Statement, print the elements of one such sequence, separated by spaces. Otherwise, print -1
.
Sample Input 1
4 5 3
1 3 5 7
1 4 1 2
2 2 3 8
Sample Output 1
2 4 3 0
For , we have , , and , so all conditions are satisfied. There are other sequences, such as and , that satisfy all conditions, and those will also be accepted.
Sample Input 2
3 7 3
1 2 3 4
3 1 9 12
2 3 2 4
Sample Output 2
-1
No sequence satisfies all conditions.
update @ 2024/3/10 11:41:11