#abc293b. B - Call the ID Number
B - Call the ID Number
Score : points
问题描述
有 名人员,其ID分别为 , , , 和 。
按照顺序,每个人员 、人员 、 以及人员 各执行以下操作一次:
- 若人员 的ID尚未被叫出,则叫出人员 的ID。
请按 升序 列举直至最后从未被叫出过ID的所有人员的ID。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are people whose IDs are , , , and .
Each of person , person , , and person performs the following action once in this order:
- If person 's ID has not been called out yet, call out person 's ID.
Enumerate the IDs of all the people whose IDs are never called out until the end in ascending order.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Enumerate the IDs of all the people whose IDs are not called out until the end in ascending order in the following format:
In other words, the first line should contain the number of people, , whose IDs are never called out until the end; the second line should contain the sequence of IDs of such people in ascending order, with spaces in between.
Sample Input 1
5
3 1 4 5 4
Sample Output 1
2
2 4
The five people's actions are as follows.
- Person 's ID has not been called out yet, so person calls out person 's ID.
- Person 's ID has not been called out yet, so person calls out person 's ID.
- Person 's ID has already been called out by person , so nothing happens.
- Person 's ID has not been called out yet, so person calls out person 's ID.
- Person 's ID has already been called out by person , so nothing happens.
Therefore, person and 's IDs are not called out until the end.
Sample Input 2
20
9 7 19 7 10 4 13 9 4 8 10 15 16 3 18 19 12 13 2 12
Sample Output 2
10
1 2 5 6 8 11 14 17 18 20
update @ 2024/3/10 12:12:06