A9305 | George and Round
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
George decided to prepare a Codesecrof round, so he has prepared $m$ problems for the round. Let's number the problems with integers $1$ through $m$ . George estimates the $i$ -th problem's complexity by integer $b_{i}$ .
To make the round good, he needs to put at least $n$ problems there. Besides, he needs to have at least one problem with complexity exactly $a_{1}$ , at least one with complexity exactly $a_{2}$ , ..., and at least one with complexity exactly $a_{n}$ . Of course, the round can also have problems with other complexities.
George has a poor imagination. It's easier for him to make some already prepared problem simpler than to come up with a new one and prepare it. George is magnificent at simplifying problems. He can simplify any already prepared problem with complexity $c$ to any positive integer complexity $d$ ( $c>=d$ ), by changing limits on the input data.
However, nothing is so simple. George understood that even if he simplifies some problems, he can run out of problems for a good round. That's why he decided to find out the minimum number of problems he needs to come up with in addition to the $m$ he's prepared in order to make a good round. Note that George can come up with a new problem of any complexity.
To make the round good, he needs to put at least $n$ problems there. Besides, he needs to have at least one problem with complexity exactly $a_{1}$ , at least one with complexity exactly $a_{2}$ , ..., and at least one with complexity exactly $a_{n}$ . Of course, the round can also have problems with other complexities.
George has a poor imagination. It's easier for him to make some already prepared problem simpler than to come up with a new one and prepare it. George is magnificent at simplifying problems. He can simplify any already prepared problem with complexity $c$ to any positive integer complexity $d$ ( $c>=d$ ), by changing limits on the input data.
However, nothing is so simple. George understood that even if he simplifies some problems, he can run out of problems for a good round. That's why he decided to find out the minimum number of problems he needs to come up with in addition to the $m$ he's prepared in order to make a good round. Note that George can come up with a new problem of any complexity.
输入格式
The first line contains two integers $n$ and $m$ ( $1<=n,m<=3000$ ) — the minimal number of problems in a good round and the number of problems George's prepared. The second line contains space-separated integers $a_{1},a_{2},...,a_{n}$ ( $1<=a_{1}<a_{2}<...<a_{n}<=10^{6}$ ) — the requirements for the complexity of the problems in a good round. The third line contains space-separated integers $b_{1},b_{2},...,b_{m}$ ( $1<=b_{1}<=b_{2}...<=b_{m}<=10^{6}$ ) — the complexities of the problems prepared by George.
输出格式
Print a single integer — the answer to the problem.
输入输出样例
输入 #1
3 5 1 2 3 1 2 2 3 3
输出 #1
0
输入 #2
3 5 1 2 3 1 1 1 1 1
输出 #2
2
输入 #3
3 1 2 3 4 1
输出 #3
3
In the first sample the set of the prepared problems meets the requirements for a good round.
In the second sample, it is enough to come up with and prepare two problems with complexities $2$ and $3$ to get a good round.
In the third sample it is very easy to get a good round if come up with and prepare extra problems with complexities: $2,3,4$ .
In the second sample, it is enough to come up with and prepare two problems with complexities $2$ and $3$ to get a good round.
In the third sample it is very easy to get a good round if come up with and prepare extra problems with complexities: $2,3,4$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted