2475 Survivors
Time Limit : 4000/2000 MS(Java/Others) | Memory Limit : 65536/32768 KB(Java/Others)
Submits : 50 | Solved : 9
Description
As you know, every people in the world has three properties: strength, dexterity and intelligence. If there is some one with all three properties equal or better than you, you will be washed out. The people who won't be washed out are called 'survivor'.
Now there are some people, find the number of the survivors.
NOTE: No two people have totally same properties.
Input
The first line contains an integer N (1 <= N <= 10^5) , which means the number of people.
Each of the next N lines contains three integers ai,bi,ci (1 <= ai,bi,ci <= 10^5) , which means the values of the i-th people's strength, dexterity and intelligence.
Output
Print the number of the survivors.
Sample Input
4
1 2 3
1 2 2
1 1 1
1 1 1000
Sample Output
2
HINT
Only the 1st and 4th people will survive.
PS: N is 100000!! It's really large!!! Solving it by brute force is IMPOSSIBLE!!!
Source
NBU OJ
[ Top ] | [ Submit ]