#P11157. 【MX-X6-T3】さよならワンダーランド
【MX-X6-T3】さよならワンダーランド
Background
Original problem link: https://oier.team/problems/X6D。
Look, let’s go You held my hand and pulled me along With those beautiful eyes, you said We are just like back then Nothing has changed At least Let the two of us dream together
Where should we look for the person who can lead you into the dreams of your childhood?
Problem Description
Given a sequence , for each integer from to , find any integer such that all of the following conditions hold, or determine that no such exists:
- ;
- 。
Input Format
The first line contains an integer 。
The next line contains space-separated integers 。
Output Format
Output lines。
For the -th line, if you can find a such that and both hold, first output , then output the you found, separated by a space. If there are multiple valid , you may output any one of them. If no such exists, output only 。
3
-1 1 4
1 2
1 1
0
5
1 -1 0 2 -3
0
1 -1
1 0
0
1 -3
Hint
Sample Explanation #1
When , we have and , satisfying 。
When , we have and , satisfying 。
When , it can be proven that no satisfies the conditions。
Constraints
For all testdata, it is guaranteed that and 。
Bundled tests, with a total of 3 subtasks. The specific limits are as follows:
- Subtask 1 (17 pts): 。
- Subtask 2 (39 pts): For all , it is guaranteed that 。
- Subtask 3 (44 pts): No additional constraints。
Translated by ChatGPT 5