/ Randle /

记录详情

Time Exceeded

/in/foo.cc: In function 'int main()':
/in/foo.cc:31:9: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   int c,b,MAX=0;
         ^
/in/foo.cc:31:7: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   int c,b,MAX=0;
       ^
# 状态 耗时 内存占用
#1 Wrong Answer 3ms 436.0 KiB
#2 Wrong Answer 2ms 324.0 KiB
#3 Accepted 2ms 440.0 KiB
#4 Wrong Answer 6ms 312.0 KiB
#5 Wrong Answer 45ms 436.0 KiB
#6 Wrong Answer 85ms 440.0 KiB
#7 Wrong Answer 843ms 436.0 KiB
#8 Time Exceeded ≥1006ms ≥328.0 KiB
#9 Time Exceeded ≥1003ms ≥432.0 KiB
#10 Time Exceeded ≥1007ms ≥440.0 KiB

代码

#include<bits/stdc++.h>
using namespace std;
int sum[10001],a[10001],ans[1001];
int n,m,t;
inline const void read(int &x)
{
	x=0;
	int k=1;
	char c=getchar();
	if(c=='-')
	{
		k=-1;
		c=getchar();
	}
	while(c>'9'||c<'0')
	c=getchar();
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	x*=k;
}
int main()
{
	//freopen("ma.in.txt","r",stdin);
	read(n);read(m);read(t);
	for(int i=1;i<=m;i++)
	{
	    
		int c,b,MAX=0;
		memset(sum,0,sizeof(sum));
		for(int j=1;j<=n;j++)
		{
			read(a[j]);
			sum[j]=sum[j-1]+a[j];
		}//cout<<"**"<<endl;
		//for(int k=1;k<=n;k++)
		//cout<<"sum["<<k<<"]="<<sum[k]<<endl;
		for(int j=1;j<=n;j++)
		{
			for(int k=1;k<=t;k++)
			{
				if(j+k-1<=n)
				{
				    int temp=sum[j+k-1]-sum[j-1];
				    //cout<<"j="<<j<<" k="<<k<<" temp="<<temp<<endl;
				    if(temp>MAX)
		    		{
			    		MAX=temp;
			    		//cout<<"MAX="<<MAX<<endl; 
			    		c=j;
			    		b=j+k-1;
			    	}
			    }
			}
		}
		//cout<<"c="<<c<<" b="<<b<<endl;
		for(int j=c;j<=b;j++)
			ans[j]++;
	}
	for(int i=1;i<=n;i++)
	cout<<ans[i]<<' ';
	cout<<endl;
	return 0;
}

信息

递交者
类型
递交
题目
骂战(原创)
题目数据
下载
语言
C++
递交时间
2017-10-12 09:24:41
评测时间
2017-10-12 09:24:41
评测机
分数
10
总耗时
≥4007ms
峰值内存
≥440.0 KiB