AtCoder Beginner Contest 187
D
Choose Me
AtCoder
⌀ 650
原题
← CE →
翻译中…

Problem Statement

翻译中…

AtCoder City will hold a mayoral election. The candidates are Aoki and Takahashi. The city consists of $N$ towns, the $i$-th of which has $A_i$ pro-Aoki voters and $B_i$ pro-Takahashi voters. There are no other voters. Takahashi can make a speech in each town. If he makes a speech in some town, all voters in that town, pro-Takahashi or pro-Aoki, will vote for Takahashi. On the other hand, if he does not make a speech in some town, the pro-Aoki voters in that town will vote for Aoki, and the pro-Takahashi voters will not vote. To get more votes than Aoki, in how many towns does Takahashi need to make speeches at least?

翻译中…

Constraints

翻译中…
  • All values in input are integers.
  • $1 \le N \le 2 \times 10^5$
  • $1 \le A_i, B_i \le 10^9$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 B_1
\vdots
A_N B_N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
4
2 1
2 2
5 1
1 3
Output #1
1
After making a speech in the third town, Aoki and Takahashi will get $5$ and $6$ votes, respectively.
Input #2
5
2 1
2 1
2 1
2 1
2 1
Output #2
3
After making speeches in three towns, Aoki and Takahashi will get $4$ and $9$ votes, respectively.
Input #3
1
273 691
Output #3
1
题目信息
题号
abc187_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。