#P2306. 被 yyh 虐的 mzc

被 yyh 虐的 mzc

Description

mzc is very rich (just kidding). He has nn male servants (those who did the previous two installments know this). But none of this can save him from being bullied by yyh, so he is asking you for help.

mzc wants to send male servants to fight yyh, but the total mass he can carry is at most mm. He wants to know whether their (yes, you read that right) total combat power can defeat yyh. Specifically, select a subset of the nn servants so that the total mass does not exceed mm and the total combat power is maximized, then determine whether this maximum is at least kk.

Input Format

The first line contains three integers n,m,kn, m, k, where nn is the number of male servants, mm is the maximum total mass he can carry, and kk is yyh’s combat power.

Then follow nn lines. Each line contains two integers ai,bia_i, b_i, denoting the mass and combat power of the ii-th male servant.

Output Format

Output two lines. If the maximum total combat power is greater than or equal to kk, output yes; otherwise, output no.

On the second line, output the maximum total combat power.

3 100 100
7 10
6 1
1 2

no
13

Hint

  • For 20%20\% of the testdata, n1000n \le 1000.
  • For 100%100\% of the testdata, n,m105n, m \le 10^5, 0ai,bi100 \le a_i, b_i \le 10.
  • Time limit: 1 second.

Translated by ChatGPT 5