#P7703. 「MCOI-09」Dream and Strings REMATCH
「MCOI-09」Dream and Strings REMATCH
Description
Given and a non-negative integer sequence .
Please find any integer sequence such that , , and .
Input Format
The first line contains a positive integer . Then follow test cases.
Each test case consists of two lines. The first line contains a positive integer , and the next line contains non-negative integers .
Output Format
Output lines. The -th line should output the sequence for the corresponding test case.
If there is no solution, output .
2
5
1 1 2 60 60
4
100 101 100 102
1 1 -1 1 -1
1 0 -1 0
Hint
This sample does not satisfy the constraint .
This problem uses bundled tests.
- Subtask 1 (50 pts): .
- Subtask 2 (50 pts): no special constraints.
Constraints for of the testdata: , , . The testdata is guaranteed to be randomly generated.
Translated by ChatGPT 5
京公网安备 11011102002149号