#abc314b. B - Roulette
B - Roulette
Score : points
问题描述
名玩家(编号为 、、、)正在玩轮盘赌。每次旋转的结果是 个整数之一,从 到 。对于每个 ,第 名玩家在 种可能的结果中押注了其中的 项:、、、。
现在轮盘已经转动并产生了结果 。请按 升序 打印所有以最少押注数押中 的玩家编号。
更正式地讲,请按照 升序 打印所有满足以下两个条件的 到 之间的整数 :
- 玩家 押中了结果 。
- 对于每个 ,如果玩家 也押中了结果 ,则有 。
请注意,可能存在没有数字需要打印的情况(参见示例输入 2)。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
people, person , person , , person , are playing roulette. The outcome of a spin is one of the integers from to . For each , person has bet on of the possible outcomes: .
The wheel has been spun, and the outcome is . Print the numbers of all people who have bet on with the fewest bets, in ascending order.
More formally, print all integers between and , inclusive, that satisfy both of the following conditions, in ascending order:
- Person has bet on .
- For each , if person has bet on , then .
Note that there may be no number to print (see Sample Input 2).
Constraints
- are all different for each .
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Let be the sequence of numbers to be printed in ascending order. Using the following format, print the count of numbers to be printed, , on the first line, and separated by spaces on the second line:
Sample Input 1
4
3
7 19 20
4
4 19 24 0
2
26 10
3
19 31 24
19
Sample Output 1
2
1 4
The wheel has been spun, and the outcome is . The people who has bet on are person , person , and person , and the number of their bets are , , and , respectively. Therefore, among the people who has bet on , the ones with the fewest bets are person and person .
Sample Input 2
3
1
1
1
2
1
3
0
Sample Output 2
0
The wheel has been spun and the outcome is , but no one has bet on , so there is no number to print.
update @ 2024/3/10 08:57:39
相关
在下列比赛中: