记录详情

Wrong Answer

/in/foo.c:22:13: warning: data definition has no type or storage class
 int a[1000];b[1000];
             ^
/in/foo.c:22:13: warning: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 204.0 KiB
#2 Accepted 1ms 128.0 KiB
#3 Accepted 1ms 220.0 KiB
#4 Accepted 0ms 224.0 KiB
#5 Accepted 0ms 216.0 KiB
#6 Wrong Answer 0ms 128.0 KiB
#7 Accepted 0ms 220.0 KiB
#8 Wrong Answer 0ms 128.0 KiB
#9 Accepted 0ms 220.0 KiB

代码

#include<stdio.h>


void pai(int a[],int b[],int s,int e)
{
    if(s==e) return;
int mid=(s+e)>>1;
int start1;int end1;
int k=s;int q=s;
pai(a,b,s,mid);pai(a,b,mid+1,e);
    start1=mid+1;end1=e;
   while(s<=mid&&start1<=end1)
   b[k++]=a[s]<a[start1]?a[s++]:a[start1++];
   while (s<=mid)
    b[k++]=a[s++];
   while(start1<=end1)
    b[k++]=a[start1++];
   for(int i=q;i<=e;i++)
   a[i]=b[i];

}
int a[1000];b[1000];
int main ()
{int n,max;
    scanf("%d",&n);scanf("%d",&max);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }

  pai(a,b,0,n-1);
    int sum=0,count=0;
    for(int i=0;i<n;i++)
    {
        count+=a[i];
    }
for(int i=0;i<n;i++)
{
    sum+=(n-i)*count;
    count-=a[i];
}
if(sum>=max)printf("Yes");
if(sum<max)printf("No");



}

信息

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