#P8686. [蓝桥杯 2019 省 A] 修改数组
[蓝桥杯 2019 省 A] 修改数组
Description
Given an array of length , the array may contain repeated integers.
Now Xiaoming wants to modify it into an array with no repeated integers using the following method. Xiaoming will modify in order.
When modifying , Xiaoming checks whether has appeared in to . If it has, Xiaoming adds to . If the new still appears before, Xiaoming keeps adding to until does not appear in to .
After is also modified as above, it is clear that there will be no duplicate integers in array .
Given the initial array , please compute the final array .
Input Format
The first line contains an integer .
The second line contains integers .
Output Format
Output integers, in order: the final .
5
2 1 1 3 4
2 1 3 4 5
Hint
For of the test cases, .
For all test cases, , .
Lanqiao Cup 2019 Provincial Contest A Group Problem H.
Translated by ChatGPT 5
京公网安备 11011102002149号