#FT0000148. Những điểm có độ trội đặc biệt (Weird Points)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Những điểm có độ trội đặc biệt (Weird Points)
Weird Points
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
You are given distinct points with integer coordinates . A point dominates another point when and . Points are compared only against other points, never themselves.
Let be the number of other points dominated by point . The number of points not dominated by it is . Its dominance score is
A point is weird if . Count the weird points.
Input
The first line contains . Each of the next lines contains one point . The PHOJ version uses one test case per program run.
Output
Print one integer: the number of points with dominance score at least .
Subtasks
- Subtask 1 (20 points): ; ; ; all coordinate pairs are distinct.
- Subtask 2 (30 points): ; ; ; all coordinate pairs are distinct.
- Subtask 3 (50 points): ; ; ; all coordinate pairs are distinct.
Examples
Example 1
Input
4 2
3 1
7 5
2 8
6 7
Output
2
Explanation
The numbers of other points dominated by the four points are . With , each has nondominated points; the scores are . Exactly two scores are at least 2.
Example 2
Input
3 1
1 1
2 2
3 3
Output
2
Explanation
Point dominates none, dominates one, and dominates both other points. With , scores are , so two points meet .