cswork / OA打开练习工作台

AmazonOA #142

Find Capable Winners

估计中等可在线判题

考点(AI 标注)贪心调度原地数组

Each player has three distinct boost values, each used once per match. X can beat Y if there exist arrangements of both players' values such that X is strictly greater than Y in at least two rounds. Count the players who can beat every other player individually; different opponents may use different arrangements.

输入格式

The first line contains n (2..100000), followed by n lines of three boost values (1..10^9); values within a line are distinct, and values may repeat across lines.

输出格式

Output a single integer answer.

样例 1

输入:

2
9 5 11
7 12 3

输出:

2

样例 2

输入:

2
1 2 3
3 4 5

输出:

1

样例 3

输入:

3
1 5 9
2 6 10
3 7 11

输出:

3

样例说明

Example 1: each side has a pairing that wins two rounds, so the answer is 2. Example 2: only the second player can beat the first, so the answer is 1. Example 3: each player's middle value exceeds every minimum and each maximum exceeds every middle value, so all three players win; the answer is 3.