LCC '23 Contest 4 J5 - Partials

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

You are in a panic! While writing the CCC and with time ticking down, you have T minutes left during the CCC. However, you know that you cannot finish each of the N subtasks remaining with the given time. Each subtask is worth x_i points (1 \le x_i \le 15) and takes t_i minutes (1 \le t_i \le T). Thus, in order to optimize your performance, you want to find the maximum number of points that you can get.

Input Specification

The first line of input will contain two space-separated integers N and T, representing the number of problems and time remaining respectively.

The next N lines of input will contain two space-separated integers x_i and t_i, representing the number of points the subtask is worth and the time the subtask takes to complete.

Output Specification

Output one integer, representing the maximum number of points that can be obtained in the T given minutes.

Subtasks

Subtask 1 [20%]

1 \le T \le 180

1 \le N \le 5

Subtask 2 [50%]

1 \le T \le 2 \times 10^3

1 \le N \le 5 \times 10^3

Subtask 3 [30%]

1 \le T \le 10^4

1 \le N \le 10^4

Sample Input 1

4 10
3 3 
5 4 
7 5
15 7

Sample Output 1

18

Sample Explanation 1

The maximum number of points attainable is through using 3 minutes to finish the first subtask, followed by using 7 minutes to finish the fourth subtask.

Sample Input 2

4 10
3 5 
8 5 
4 6
10 8

Sample Output 2

11

Sample Explanation 2

The maximum number of points attainable is through using 10 minutes to finish the first two subtasks.


Comments

There are no comments at the moment.