#abc306c. C - Centers
C - Centers
Score : points
问题陈述
你给定一个长度为 的序列 ,其中每个数字 恰好出现三次。
对于 ,令 表示 在序列 中的中间位置索引。按照 的升序对 进行排序。
正式地, 定义如下:
- 假设满足 的所有 分别为 。那么,。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a sequence of length where each of , and occurs exactly three times.
For , let be the index of the middle occurrence of in . Sort in ascending order of .
Formally, is defined as follows.
- Suppose that those such that are . Then, .
Constraints
- occurs in exactly three times, for each .
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the sequence of length obtained by sorting in ascending order of , separated by spaces.
Sample Input 1
3
1 1 3 2 3 2 2 3 1
Sample Output 1
1 3 2
- occurs in at , so .
- occurs in at , so .
- occurs in at , so .
Thus, , so , and should be printed in this order.
Sample Input 2
1
1 1 1
Sample Output 2
1
Sample Input 3
4
2 3 4 3 4 1 3 1 1 4 2 2
Sample Output 3
3 4 1 2
update @ 2024/3/10 08:38:23