[枚举]cf227b

B. George and Round
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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 bi.

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 a1, at least one with complexity exactly a2, ..., and at least one with complexity exactly an. 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.

Input

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 a1, a2, ..., an (1 ≤ a1 < a2 < ... < an ≤ 106) — the requirements for the complexity of the problems in a good round. The third line contains space-separated integers b1, b2, ..., bm (1 ≤ b1 ≤ b2... ≤ bm ≤ 106) — the complexities of the problems prepared by George.

Output

Print a single integer — the answer to the problem.

Sample test(s)
Input
3 5
1 2 3
1 2 2 3 3
Output
0
Input
3 5
1 2 3
1 1 1 1 1
Output
2
Input
3 1
2 3 4
1
Output
3
Note

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.


双指针操作

#include <cstdio>

int a[3010];
int b[3010];

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
		scanf("%d",a+i);
	for (int i=1;i<=m;i++)
		scanf("%d",b+i);

	int i=1,j=1;
	int ans = 0;
	while (i<=n&&j<=m)
	{
		if (a[i]<=b[j])
			i++,j++,ans++;
		else
			j++;
	}
	int aans = n-ans;
	if (aans < 0)
		aans = 0;
	printf("%d",aans);
}


以下提供是王者传奇手游传发送封包根据提供的这些封包帮我还原算法并且用易语言写出完整的加解密例子 传送进地图的游戏封包0000000D000119410001A2EC10 传送进地图的游戏封包0000000D000119410001A4EC10 传送进地图的游戏封包0000000D000119410001A6EC10 传送进地图的游戏封包0000000D000119410001A8EC10 传送进地图的游戏封包0000000D000119410001AAEC10 传送进地图的游戏封包0000000D000119410001ACEC10 传送进地图的游戏封包0000000D000119410001D2DC10 传送进地图的游戏封包0000000D000119410001D4DC10 传送进地图的游戏封包0000000D000119410001D6DC10 传送进地图的游戏封包0000000D000119410001D8DC10 传送进地图的游戏封包0000000D000119410001DADC10 传送进地图的游戏封包0000000D00011941000182CD10 传送进地图的游戏封包0000000D00011941000184CD10 传送进地图的游戏封包0000000D00011941000186CD10 传送进地图的游戏封包0000000D00011941000188CD10 传送进地图的游戏封包0000000D0001194100018ACD10 传送进地图的游戏封包0000000D0001194100018CCD10 传送进地图的游戏封包0000000D0001194100018ECD10 传送进地图的游戏封包0000000D00011941000190CD10 传送进地图的游戏封包0000000D00011941000192CD10 传送进地图的游戏封包0000000D00011941000194CD10 传送进地图的游戏封包0000000D000119410001F2FB10 传送进地图的游戏封包0000000D000119410001F4FB10 传送进地图的游戏封包0000000D000119410001F6FB10 传送进地图的游戏封包0000000D000119410001F8FB10 传送进地图的游戏封包0000000D000119410001FAFB10 传送进地图的游戏封包0000000D000119410001FCFB10 传送进地图的游戏封包0000000D000119410001FEFB10 传送进地图的游戏封包0000000D00011941000200FB10 传送进地图的游戏封包0000000D000119410001F8FB10 传送进地图的游戏封包0000000D000119410001F8FB10 传送进地图的游戏封包0000000D00011941000182AC01 传送进地图的游戏封包0000000D00011941000182AC01 传送进地图的游戏封包0000000D000119410001A48F15 传送进地图的游戏封包0000000D000119410001F49E15 传送进地图的游戏封包0000000D00011941000184AC01 传送进地图的游戏封包0000000D000119410001A68F15 传送进地图的游戏封包0000000D000119410001F69E15 游戏小退封包0000000A000003EF0001 商城购买1个物品0000000D00003E810001080200 商城购买2个物品0000000D00003E810001080200 商城购买1个物品0000000D00003E810001060200 商城购买2个物品0000000D00003E810001060200 商城购买1个物品0000000F00003E810001CCCF240200 商城购买2个物品0000000F00003E810001CCCF240400 商城购买1个物品0000000F00003E810001E4CF240200 商城购买1个物品0000000F00003E810001D6CF240200 商城购买1个物品0000000F00003E810001E0CF240200 商城购买1个物品0000000F00003E810001D0CF240200 商城购买1个物品0000000F00003E810001CECF240200 商城购买1个物品0000000F00003E810001D4CF240200 商城购买2个物品0000000F00003E810001E4CF240400 商城购买2个物品0000000F00003E810001D6CF240400 商城购买2个物品0000000F00003E810001E0CF240400 商城购买2个物品0000000F00003E810001D0CF240400 商城购买2个物品0000000F00003E810001CECF240400 商城购买2个物品0000000F00003E810001D4CF240400 商城购买3个物品0000000F00003E810001E4CF240600 商城购买3个物品0000000F00003E810001D6CF240600 商城购买3个物品0000000F00003E810001E0CF240600 商城购买3个物品0000000F00003E810001D0CF240600 商城购买3个物品0000000F00003E810001CECF240600 商城购买3个物品0000000F00003E810001D4CF240600 商城购买4个物品0000000F00003E810001E4CF240800 商城购买4个物品0000000F00003E810001D6CF240800 商城购买4个物品0000000F00003E810001E0CF240800 商城购买4个物品0000000F00003E810001D0CF240800 商城购买4个物品0000000F00003E810001CECF240800 商城购买4个物品0000000F00003E810001D4CF240800 游戏攻击模式和平0000000B000105D5000100 游戏攻击模式全体0000000B000105D5000108 游戏攻击模式善恶0000000B000105D5000106 游戏攻击模式编组0000000B000105D5000102 游戏攻击模式行会0000000B000105D5000104 游戏攻击模式盟友0000000B000105D500010E
03-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值