P27732 [洛谷] [SEERC2020] Neo-Robin Hood
提高+
题目描述

Problem Description

You are a thief, and there are $n$ households in the town. For each household $i$, you have the following choices:

  • Steal $m_i$ dollars from them, which will make them hate you.
  • Give them $p_i$ dollars, which will make one person you have stolen from cancel their hatred towards you.
  • Do nothing.

Initially, you have no money. You want to know the maximum number of households you can steal from, such that no one hates you and you have a non-negative amount of money.

Input Format

The first line contains an integer $n\ (1 \leq n \leq 10^5)$.

The second line contains a sequence of $n$ integers $m\ (1 \leq m_i \leq 10^9)$.

The third line contains a sequence of $n$ integers $p\ (1 \leq p_i \leq 10^9)$.

Output Format

Output the maximum number of households you can steal from.

Sample Input and Output

Sample Input #1

5
2 3 4 5 6
1 2 3 4 5

Sample Output #1

2

Sample Input #2

4
1 2 4 2
5 6 9 7

Sample Output #2

0

Sample Input #3

4
9 19 6 5
20 3 16 19

Sample Output #3

1
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 2 3 4 5 6 1 2 3 4 5
样例输出
2