/ 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 Accepted 4ms 376.0 KiB
#2 Accepted 3ms 364.0 KiB
#3 Accepted 3ms 360.0 KiB
#4 Accepted 331ms 348.0 KiB
#5 Time Exceeded ≥1007ms ≥384.0 KiB
#6 Time Exceeded ≥1007ms ≥340.0 KiB
#7 Time Exceeded ≥1007ms ≥348.0 KiB
#8 Time Exceeded ≥1007ms ≥384.0 KiB
#9 Time Exceeded ≥1007ms ≥348.0 KiB
#10 Time Exceeded ≥1007ms ≥376.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();
	while(c>'9'||c<'0')
	{
		if(c=='-')
		k=-1;
	    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);
	//m=3;
	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:39:45
评测时间
2017-10-12 09:39:45
评测机
分数
40
总耗时
≥6387ms
峰值内存
≥384.0 KiB