Job Completion
시간 제한2초메모리 제한2048 MB
각 작업에 시작 기한 s_i와 소요 시간 t_i가 주어질 때, 시간 0에서 한 번에 하나씩 처리해 완료할 수 있는 최대 작업 수를 구한다.
문제
Bessie the cow has () jobs for you to potentially complete. The -th one, if you choose to complete it, must be started at or before time and takes time to complete ().
What is the maximum number of jobs you can complete? Time starts at , and once you start a job you must work on it until it is complete, without starting any other jobs in the meantime.
입력
The first line contains , the number of independent test cases (). Each test case is formatted as follows.
The first line contains .
Each of the next lines contains two integers and . Row has the details for the th job.
It is guaranteed that the sum of over all test cases does not exceed .
출력
For each test case, the maximum number of jobs you can complete, on a new line.
힌트
For the first test case, you can only complete one of the jobs. After completing one job, it will then be time or later, so it is too late to start the other job, which must be started at time or earlier.
For the second test case, you can start the second job at time and finish at time , then start the first job at time and finish at time .