F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Go Running

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 2315    Accepted Submission(s): 782


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.
 

Sample Input
2 3 1 1 2 2 3 1 3 1 1 2 2 3 3
 

Sample Output
2 1
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-21 21:23:25, Gzip enabled