luogu#P1910. L 国的战斗之间谍

L 国的战斗之间谍

Background

{{Country L is about to go to war with Country I.}}

Problem Description

{{As the saying goes: "Know yourself and know your enemy, and you will never be defeated in a hundred battles." The commander of Country L wants to send spies to Country I, so the task of selection falls on you.

You now have NN candidates. Each person has the following data: AA (how much intelligence they can obtain), BB (how poor their disguise capability is), and CC (the salary they demand). The enemy's counterintelligence capability is known to be MM (that is, the sum of BB for all selected people must be less than or equal to MM), and you have XX units of money. What is the maximum amount of intelligence you can obtain?}}

Input Format

{{The first line contains three integers N,M,XN, M, X representing the total number of candidates, the enemy's reconnaissance capability, and the total amount of money.

From the second line to the (N+1)(N + 1)-th line, each line contains three integers Ai,Bi,CiA_i, B_i, C_i, indicating the intelligence the ii-th person can obtain, how poor their disguise is, and the salary they demand.}}

Output Format

{{Output a single integer representing the total amount of intelligence that can be obtained.}}

3 10 12
10 1 11
1 9 1
7 10 12

11

Hint

{{For 100%100\% of the testdata, 1N1001 \le N \le 100, 1M10001 \le M \le 1000, and 1X10001 \le X \le 1000.}}

Translated by ChatGPT 5