/ Randle /

记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 3ms 304.0 KiB
#2 Accepted 2ms 312.0 KiB
#3 Time Exceeded ≥1004ms ≥324.0 KiB
#4 Wrong Answer 4ms 312.0 KiB
#5 Wrong Answer 3ms 308.0 KiB
#6 Wrong Answer 2ms 312.0 KiB
#7 Wrong Answer 1ms 308.0 KiB
#8 Wrong Answer 3ms 308.0 KiB
#9 Wrong Answer 1ms 324.0 KiB
#10 Wrong Answer 2ms 312.0 KiB

代码

#include<bits/stdc++.h>
using namespace std;
int m,n,t;
struct node
{
	int left,num;
}ans[1001];
int a[1001],tt[1001];
inline const void read(int &a)
{
	a=0;
	int k=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-')
		k=-1;
		c=getchar();
	}
	while(c<='9'&&c>='0')
	{
		a=(a<<1)+(a<<3)+c-'0';
		c=getchar();
	}
	a*=k;
} 
int main()
{
	//freopen("ma.in.txt","r",stdin);
	cin>>n>>m>>t;
	m=10;
	for(int i=1;i<=m;i++)
	{
		for(int i=0;i<=1001&&ans[i].left;i++)
		{
			ans[i].left=0;
			ans[i].num=0;
		}
		int front=0,rail=0,MAX=0;
		for(int j=1;j<=n;j++)
		{
			read(a[j]);
			if(ans[j-1].num==0&&ans[j-1].left==0)
			{
				ans[j].left=j;
				ans[j].num=a[j];
				MAX=a[j];
				front=j;
				rail=j;
				//cout<<"1"<<endl;
				//cout<<"j="<<j<<" MAX="<<MAX<<" front="<<front<<" rail="<<rail<<endl;
			}
			else if(ans[j-1].num<0)
			{
				ans[j].left=j;
				ans[j].num=a[j];
				if(MAX<ans[j].num)
				{
					MAX=ans[j].num;
					front=j;
					rail=j;
				//	cout<<"j="<<j<<" MAX="<<MAX<<" front="<<front<<" rail="<<rail<<endl;
				}
			//	cout<<"2"<<endl;
			}
			else if(ans[j-1].num>=0)
			{
				if(j-ans[j-1].left<=t-1)
				{
					ans[j].left=ans[j-1].left;
					ans[j].num=ans[j-1].num+a[j];
					if(ans[j].num>MAX)
					{
						MAX=ans[j].num;
						front=ans[j].left;
						rail=j;
						//cout<<"j="<<j<<" MAX="<<MAX<<" front="<<front<<" rail="<<rail<<endl;
					}
					//cout<<"3"<<endl;
				}
				else if(j-ans[j-1].left>t-1)
				{
					ans[j].left=ans[j-1].left+1;
					ans[j].num=ans[j-1].num-a[ans[j-1].left]+a[j];
					if(ans[j].num>MAX)
					{
						MAX=ans[j].num;
						front=ans[j].left;
						rail=j;
						//cout<<"j="<<j<<" MAX="<<MAX<<" front="<<front<<" rail="<<rail<<endl;
					} 
					//cout<<"4"<<endl;
				}
			}
		}
		//cout<<"front="<<front<<" rail="<<rail<<endl;
		for(int j=front;j<=rail;j++)
		tt[j]++;
	}	
	for(int i=1;i<=n;i++)
	cout<<tt[i]<<' ';
	cout<<endl;
	return 0;
}

信息

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