Go Running

TimeLimit:5000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
Zhang3 is the class leader. Recently she's implementing a policy about long-distance running. This forces every student in her class to take a run.

There is a main road in the school from west to east, which can be regarded as an infinite axis, and its positive direction is east. Positions on the road are represented with numbers. In order to complete the task, each student must run along the main road. Each student can decide the following things:

- The time to start running.
- The time to finish running.
- The position to start running.
- The direction of running, which is either west or east.

Once these things are decided, the student will appear at the starting position on the road at the start time, then start running in the chosen direction at a speed of $1 \; \text{m/s}$. The student disappears at the finish time. Each student will only run once.

Zhang3 knows that some students are not following her policy, so she set up some monitors. According to technical issues, the monitors can only report that there's at least one student at a certain place at a certain time. Finally Zhang3 received $n$ reports.

Help Zhang3 determine the minimum possible number of students who have run.
Input
The first line of the input gives the number of test cases, $T \; (1 \le T \le 100)$. $T$ test cases follow.

For each test case, the first line contains an integer $n \; (1 \le n \le 10^5)$, the number of reports.

Then $n$ lines follow, the $i ^ \mathrm{th}$ of which contains two integers $t_i, x_i \; (1 \le t_i, x_i \le 10^9)$, representing that there's at least one student at position $x_i \; \text{(m)}$ at time $t_i \; \text{(s)}$.

The sum of $n$ in all test cases doesn't exceed $5 \times 10^5$.
Output
For each test case, print a line with an integer, representing the minimum number of students who have run.
SampleInput
2
3
1 1
2 2
3 1
3
1 1
2 2
3 3
SampleOutput
2
1
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: