#BS0000339. Chọn bài thi tối ưu (Too Easy Problems)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Chọn bài thi tối ưu (Too Easy Problems)
Too Easy Problems
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
An exam has problems and a time budget of milliseconds. Solving problem takes milliseconds. If you solve problems in total, a solved problem earns one point exactly when . Select a subset within the time budget that maximizes the score.
Input
First line: . Each of the next lines contains . Problems are numbered 1 through .
Output
Print the optimal score , then the number of chosen problems on the next line, then distinct indices in any order. The third line may be empty when . Any optimal valid subset is accepted; is not required.
Subtask
- Subtask 1 (20 points): ; ; ; .
- Subtask 2 (30 points): ; ; ; . for every .
- Subtask 3 (50 points): ; ; ; .
Examples
Input 1
5 300
3 100
4 150
4 80
2 90
2 300
Output 1
2
3
3 1 4
Explanation
Problems 3, 1 and 4 cost 270 and earn two points. Three scoring problems would require all three problems with a ≥ 3, costing 330.
Input 2
2 100
1 787
2 788
Output 2
0
0
Explanation
No problem fits the budget.