#P7726. 天体探测仪(Astral Detector)
天体探测仪(Astral Detector)
Background
By exploring the ancient archives, you successfully built the Astral Detector. You need to use it to discover hidden astral technology.
Problem Description
To find the astral technology, you first need to obtain a string of astral codes—it is a permutation of .
The Astral Detector can, for a given length , return the minimum value of an interval of length in the code.
Unfortunately, the minimum values of all intervals of length are mixed together. What you get is only multisets :
- denotes the multiset formed by the minimum values of all intervals of length .
You need to reconstruct one possible astral code from these . It is guaranteed that at least one correct astral code exists.
Input Format
The first line contains an integer , representing the length of the astral code.
The next lines follow. The -th line contains integers (there are intervals of length ), representing each element in the multiset . Note that the order of the elements is arbitrary, and is not necessarily the left-to-right order of the intervals.
Output Format
Output one line with integers , representing the astral code you reconstructed.
If there are multiple feasible solutions, you may output any one of them.
4
4 3 2 1
1 2 1
1 1
1
3 1 2 4
Hint
[Sample 1 Explanation]
The astral code in the sample output is: .
The multiset of minimum values of intervals of length : .
The multiset of minimum values of intervals of length : $S_2 = \{ \min(3, 1), \min(1, 2), \min(2, 4) \} = \{ 1, 1, 2 \} = \{ 1, 2, 1 \}$.
The multiset of minimum values of intervals of length : $S_3 = \{ \min(3, 1, 2), \min(1, 2, 4) \} = \{ 1, 1 \}$.
The multiset of minimum values of intervals of length : .
Each corresponds to the input.
Other feasible answers are also accepted, such as .
[Constraints]
This problem uses bundled testdata.
For of the data: .
| Subtask ID | Score | Special Constraints | |
|---|---|---|---|
| None | |||
| For each , there are no two equal elements in | |||
| None |
Translated by ChatGPT 5