#P6433. 「EZEC-1」出题

「EZEC-1」出题

Background

You are a nasty problem setter.

Problem Description

You have nn nasty problems. The statements are already written, but the testdata has not been prepared yet. You still have mm units of time. The nastiness of each problem is aia_i, and the time needed to prepare its testdata is xix_i. You have kk teachers. Each teacher can double the nastiness of one problem (each problem can be doubled at most once). Your parents strongly oppose you holding an open contest, so they have taken away one of your problems. Now you can control both the teachers' and your parents' actions, but every teacher's action and your parents' action must be carried out. What should you do to maximize the sum of nastiness of the problems you end up producing?

Input Format

The first line contains three integers: n,m,kn, m, k.

The next nn lines each contain 22 integers, ai,xia_i, x_i.

Output Format

Output one integer: the maximum possible sum of nastiness.

3 10 1
6 9
7 2
1 8
15
5 20 2
5 3 
9 7
2 6
7 8
1 2
38
3 6 2
5 4
3 3
3 3
12

Hint

[Sample Explanation]

Sample 11:

You control your parents to take away T1T1. Then you prepare the testdata for T2T2 and T3T3, and also double the nastiness of T2T2. Therefore, the maximum total nastiness is 1515.


[Constraints]

For 30%30\% of the testdata, 0xim0 \le x_i \le m, 0m1000 \le m \le 100, 2n102 \le n \le 10, and k<nk < n.

For another 20%20\% of the testdata, it is guaranteed that k=0k = 0.

For 100%100\% of the testdata, 0ai10000 \le a_i \le 1000, 0xim0 \le x_i \le m, 0m10000 \le m \le 1000, 0n1000 \le n \le 100, and k<nk < n.

upd in 2020.7.6: One set of hack testdata was added.

Translated by ChatGPT 5