P26966 [AtCoder] White and Blue
提高+
题目描述

Problem Description

In the parliament of the Apple Kingdom, a vote on a certain bill is being held.

$ N $ members of parliament are present, and the $ i $-th member $(1 \leq i \leq N)$ has $ w_i $ white votes and $ b_i $ blue votes. Each member $ i $ will put all $ w_i $ white votes into the ballot box if they support the bill, and all $ b_i $ blue votes if they oppose the bill. No other actions are allowed. For example, members are not allowed to abstain from voting or to put only a part of their white or blue votes into the ballot box.

After all members have voted, if at least $ P $ percent of the votes in the ballot box are white, the bill is passed; otherwise, it is rejected.

To pass the bill, at least how many members need to support it?

Input Format

The input is given from the standard input in the following format:

$ N $ $ P $ $ w_1 $ $ b_1 $ $ w_2 $ $ b_2 $ $ : $ $ w_N $ $ b_N $

Output Format

Output the minimum number of supporting members required to pass the bill.

Sample Input and Output

Sample Input #1

4 75
1 1
1 1
1 1
1 1

Sample Output #1

3

Sample Input #2

4 75
1 1
1 1
1 1
100 1

Sample Output #2

1

Sample Input #3

5 60
6 3
5 9
3 4
7 8
4 7

Sample Output #3

3

Notes/Hints

Constraints

  • $1 \leq N \leq 10^5$
  • $1 \leq P \leq 100$
  • $1 \leq w_i \leq 10^9$
  • $1 \leq b_i \leq 10^9$
  • All input values are integers.

Sample Explanation 1

A "normal" vote where each of the $ 4 $ members has $ 1 $ white vote and $ 1 $ blue vote. To pass the bill, at least $ 75 $ percent of the $ 4 $ members, which is $ 3 $ members, need to support it.

Sample Explanation 2

The bill is passed with the support of just $ 1 $ member who has $ 100 $ white votes.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 75 1 1 1 1 1 1 1 1
样例输出
3