문제
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.
예제 입력 1
3
2
1 4
1 2
2
2 3
1 2
3
1 4
2 3
1 2
예제 출력 1
1
2
2
점수
Inputs 2: Within the same test case, all are equal.Inputs 3-4: , Inputs 5-8: Inputs 9-16: No additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인