QOJ.ac

QOJ

时间限制: 3 s 内存限制: 1024 MB 总分: 100 可 Hack ✓

#13980. 儿玉层级

统计

一组木灵

你目前正试图招募一支木灵(kodama)小队以统治世界。

你可以从 $N$ 个木灵中选择一个子集作为你的小组。第 $i$ 个木灵拥有魅力值 $c_i$ 和气场值 $a_i$。$c_i$ 和 $a_i$ 均为非负数。

木灵在等级制度下生存。这意味着,只有当小组中的任何其他木灵在气场和魅力上都严格低于严格高于该木灵时,木灵们才会对这个小组感到满意。换句话说,如果一个木灵的气场较高而另一个木灵的魅力较高,或者它们在任一属性上相等,则这两个木灵不能同时存在于该小组中。

然而,木灵也是社交性生物。如果可以从其余的 $N$ 个木灵中选择任意非空子集加入到你当前的小组中,且在不移除当前小组中任何木灵的前提下,仍然满足上述等级规则,那么木灵们就会对你发出咔哒咔哒的抗议声,从而不允许你组建该小组。

由于木灵非常混乱,你希望为小组挑选尽可能少的木灵。请找出你可以组建的有效小组的最小木灵数量。

输入格式

第一行包含一个整数 $N$ ($1 \le N \le 2 \cdot 10^5$),表示木灵的数量。

接下来 $N$ 行,每行包含两个空格分隔的整数 $a_i$ ($0 \le a_i \le 10^9$) 和 $c_i$ ($0 \le c_i \le 10^9$),分别表示第 $i$ 个木灵的气场值和魅力值。

输出格式

输出一行,包含一个整数,表示你可以组建的有效木灵小组的最小人数。

样例

输入样例 1

5
2 0
0 32
7 10
4 88
5 47

输出样例 1

2

输入样例 2

6
6 3
13 11
7 10
10 15
9 5
2 5

输出样例 2

3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.