记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 128.0 KiB
#2 Wrong Answer 1ms 216.0 KiB
#3 Wrong Answer 1ms 128.0 KiB
#4 Wrong Answer 0ms 220.0 KiB
#5 Wrong Answer 1ms 128.0 KiB
#6 Wrong Answer 0ms 220.0 KiB
#7 Wrong Answer 0ms 128.0 KiB
#8 Wrong Answer 0ms 128.0 KiB
#9 Wrong Answer 0ms 128.0 KiB

代码

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define rep(i,j,k) for(int i = (j); i <= (k); i++)
typedef unsigned long long ULL;
int main()
{
	int n; ULL m;
	scanf("%d%llu", &n, &m);
	int* a = (int*)malloc(n * sizeof(int));
	memset(a, 0, n * sizeof(int));
	rep(i, 0, n - 1)
		scanf("%d", &a[i]);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n - i - 1; j++)
			if (a[j] > a[j + 1])
			{
				int temp = a[j];
				a[j] = a[j + 1];
				a[j + 1] = temp;
			}
	rep(i, 0, n - 1)
		printf(" %d", a[i]);
	int occupy = 0;
	ULL ambition = 0;
	int flag = 0;
	rep(i, 1, n)
	{
		ambition += a[i - 1] * (n - occupy);
		if (ambition > m)
		{
			flag = 1;
			break;
		}
		occupy++;
	}
	if (flag)
		printf("Yes");
	else
		printf("No");
	return 0;
}

信息

递交者
类型
递交
题目
P1007 hitwh 2019 新生赛 H Songer and his army
语言
C
递交时间
2020-12-18 11:15:26
评测时间
2020-12-18 11:15:26
评测机
分数
0
总耗时
9ms
峰值内存
220.0 KiB