PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CC0000057. So sánh xếp hạng lập trình viên (Coder Ratings)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
So sánh xếp hạng lập trình viên (Coder Ratings)
Coder Ratings
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Each coder has an Open rating and a High School rating . Coder is better than coder if and , with at least one inequality strict. Count how many coders each coder is better than.
Input
The first line is , followed by pairs of ratings .
Output
Print lines with the number of coders each original coder is better than.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
8
1798 1832
862 700
1075 1089
1568 1557
2575 1984
1033 950
1656 1649
1014 1473
Output
6
0
2
4
7
1
5
1
Explanation
Coder 5 dominates all seven other coders; coder 2 dominates none. Identical rating pairs never dominate each other under the required strictness.