#P10672. 【MX-S1-T1】 壁垒
【MX-S1-T1】 壁垒
Background
Original link: https://oier.team/problems/S1A。
Problem Description
You are given a sequence of length consisting only of positive integers, and it is guaranteed that is even. You need to reorder so that, for every prefix of whose length is even, the number of distinct values that have appeared is even, or determine that no such reordering exists。
If there are multiple reorderings that satisfy the condition, you may output any one of them。
Input Format
The first line contains one positive integer , and it is guaranteed that is even。
The second line contains positive integers describing the sequence 。
Output Format
If there is no solution, output . Otherwise, output one line with integers describing the reordered sequence 。
This problem uses a custom checker to verify whether your output is correct. If there are multiple reorderings that satisfy the condition, you may output any one of them。
6
2 3 3 4 1 1
1 3 3 1 2 4
2
1 1
-1
Hint
Sample Explanation 1
The sets , , and all have an even number of distinct values。
Constraints
This problem uses bundled subtasks.
For of the testdata, , , and it is guaranteed that is even。
| Subtask ID | Points | ||
|---|---|---|---|
Translated by ChatGPT 5