#P2306. Battle of the Male Servants

    ID: 15580 Type: Default 1000ms 256MiB

Battle of the Male Servants

Battle of the Male Servants

mzc is in trouble! Although his household is wealthy and he has n male servants at his disposal, they are not enough to save him from the relentless assault of yyh. mzc now plans to deploy these servants into battle against yyh. However, his vehicle can only carry a total weight of m. Each servant has a specific weight and a fighting power, and mzc wants to know if the optimal selection of servants (i.e. the subset whose total weight ≤ m that maximizes fighting power) is strong enough to overcome yyh.

You are given n servants. The i-th servant has a weight w_i and a fighting power f_i. Also given is an integer p representing the fighting power of yyh. Determine whether the maximum total fighting power achievable under the weight constraint is at least p.

The weight constraint can be expressed in LaTeX format as:

iSwim\sum_{i \in S} w_i \le m

and the condition for victory is:

$$\max_{S \subseteq \{1,2,\ldots,n\} \;\text{with } \sum_{i \in S} w_i \le m} \sum_{i \in S} f_i \ge p $$

inputFormat

The input consists of multiple lines. The first line contains three integers n, m, and p, where n is the number of male servants, m is the maximum weight capacity, and p is the fighting power of yyh. Each of the next n lines contains two integers w and f, representing the weight and fighting power of a servant, respectively.

outputFormat

Output a single string: print "Yes" if the maximum total fighting power achievable without exceeding the weight capacity is at least p; otherwise, print "No".

sample

3 10 15
5 10
4 7
6 12
Yes