#abc354c. C - AtCoder Magics
C - AtCoder Magics
Score : points
问题陈述
高桥有来自卡牌游戏“AtCoder Magics”的张卡牌。第张卡牌将被称为卡牌。每张卡牌有两个参数:力量和成本。卡牌的力量为,成本为。
他不喜欢弱的卡牌,所以他将丢弃它们。具体来说,他将重复以下操作,直到无法再执行:
- 选择两张卡牌和,使得且。丢弃卡牌。
可以证明,当操作无法再执行时,剩余卡牌的集合是唯一确定的。找出这个卡牌集合。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
Takahashi has cards from the card game "AtCoder Magics." The -th card will be called card . Each card has two parameters: strength and cost. Card has a strength of and a cost of .
He does not like weak cards, so he will discard them. Specifically, he will repeat the following operation until it can no longer be performed:
- Choose two cards and such that and . Discard card .
It can be proved that the set of remaining cards when the operations can no longer be performed is uniquely determined. Find this set of cards.
Constraints
- are all distinct.
- are all distinct.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Let there be remaining cards, cards , in ascending order. Print these in the following format:
Sample Input 1
3
2 4
1 1
3 2
Sample Output 1
2
2 3
Focusing on cards and , we have and , so card can be discarded.
No further operations can be performed. At this point, cards and remain, so print them.
Sample Input 2
5
1 1
10 2
100 3
1000 4
10000 5
Sample Output 2
5
1 2 3 4 5
In this case, no cards can be discarded.
Sample Input 3
6
32 101
65 78
2 29
46 55
103 130
52 40
Sample Output 3
4
2 3 5 6
相关
在下列比赛中: