#P8029. [COCI 2021/2022 #3] Akcija
[COCI 2021/2022 #3] Akcija
Description
Given products, each product has a price and a deadline , where means that product must be purchased before minute . Each purchase of one product takes minute to place the order, and the purchase is considered successful only after the order is placed.
Now you may choose some of these products (including choosing products) to buy (each product can be bought at most once), which is considered a purchasing plan.
When the number of products in one plan is greater than that in another plan, the former plan is defined to be better. When two plans have the same number of products and the former has a lower total price, the former plan is defined to be better. Among all purchasing plans that satisfy the requirements, find the number of products and the total price for the best plans.
Input Format
The first line contains two positive integers . The testdata guarantees that is not greater than the total number of valid plans.
The next lines each contain two positive integers .
Output Format
Output lines. The -th line should contain the number of products and the total price of the -th best plan.
3 1
1 1
1 1
1 3
2 2
4 3
1 1
10 1
2 3
10 3
3 13
3 22
2 3
2 4
1 1
2 2
2 3
1 1
1 2
0 0
Hint
[Explanation for Sample 2]
The top best plans are , , and (using product indices to represent the products).
[Constraints and Notes]
This problem uses bundled subtasks.
- Subtask 1 (10 pts): , .
- Subtask 2 (20 pts): .
- Subtask 3 (20 pts): .
- Subtask 4 (10 pts): .
- Subtask 5 (30 pts): .
- Subtask 6 (20 pts): No special restrictions.
For of the testdata, , , .
[Hints and Notes]
In the official data, each subtask has test points, and the total time limit is as high as minutes. To reduce the burden on the judging servers, only the first two test points of each subtask are used for judging here.
This problem is translated from COCI 2021-2022 CONTEST #3 Task 3 Akcija.
The score of this problem follows the original COCI settings, with a full score of .
Translated by ChatGPT 5
京公网安备 11011102002149号