/ tabris /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 2ms 204.0 KiB
#2 Accepted 2ms 216.0 KiB
#3 Accepted 2ms 212.0 KiB
#4 Accepted 2ms 212.0 KiB
#5 Accepted 2ms 216.0 KiB
#6 Accepted 1ms 216.0 KiB
#7 Accepted 2ms 200.0 KiB
#8 Accepted 2ms 216.0 KiB
#9 Accepted 2ms 212.0 KiB
#10 Accepted 2ms 200.0 KiB

代码

#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int a[1005], b[1005], c[1005];
int main()
{
	int n, m, number = 0;
	while(scanf("%d%d", &n, &m) != EOF)
	{ 
		++number;
		int ans = 0;
		memset(c, 0, sizeof(c));
		for(int i = 0;i < n;++i)
			scanf("%d", &a[i]);
		for(int i = 0;i < m;++i)
			scanf("%d", &b[i]);
		sort(a, a + n);
		for(int i = 0;i < m;++i)
		{
			for(int j = n - 1;j >= 0;--j)
			{
				if(a[j] >=b[i])
					++c[i];
				else
					break;
			} 
		}
		for(int i = 0;i < m; ++i)
		{
			if(c[i] == 0)
				++ans;
		}
		printf("Case #%d:\n",number);
		
		if(ans == 0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		for(int i = 0;i < m;++i)
		{
			printf("%d ", c[i]);
		} 
		printf("\n");
		
	}
	return 0;
}

信息

递交者
类型
递交
语言
C++
递交时间
2019-06-11 12:52:01
评测时间
2019-06-11 12:52:01
评测机
分数
100
总耗时
23ms
峰值内存
216.0 KiB