Classical Scheduling Problem
시간 제한6초메모리 제한1024 MB
시간 t 안에서 주제 부분집합을 골라, 선택한 주제 수가 b_i 이상인 주제의 개수를 최대로 만들고 그 부분집합을 출력한다.
문제
You have minutes until a very important exam in a very important subject. You have a list of different topics of the subject, numbered from to . It takes minutes to learn the -th topic.
However, the subject is pretty complicated, and even if you learn some topic, you might not necessarily be confident about it during the exam. You know that to be confident about the -th topic, you need to learn at least topics in total (including topic ).
It takes no time to switch from one topic to another while learning. Thus, you have enough time to learn distinct topics if , and you will be confident about topic during the exam if . Note that the order in which you learn the topics is not important.
You want to figure out what topics you should learn before the exam to maximize the number of topics you will be confident about.
입력
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The first line of each test case contains two integers and , denoting the number of topics and the amount of time you have until the exam (; ).
The -th of the next lines contains two integers and , denoting the amount of time it takes to learn the -th topic and the total number of topics you need to learn to be confident about the -th topic (; ).
It is guaranteed that the sum of over all test cases does not exceed .
출력
For each test case, print the maximum number of topics you can be confident about during the exam.
Then print , denoting the number of topics you should learn, followed by distinct integers in any order, denoting the indices of the topics you should learn (; ).
If there are multiple solutions, print any of them.
힌트
In the first test case, you should learn topics , , and . This will take you minutes, which is fine since you have minutes until the exam. Even though you will not be confident about topic (you would need to learn all four topics for that), you will be confident about topics and . It is impossible to be confident about more than two topics in this test case.