/ Randle /

记录详情

Time Exceeded

/in/foo.cc: In function 'int main()':
/in/foo.cc:27:6: warning: unused variable 'ai' [-Wunused-variable]
  int ai;
      ^~
# 状态 耗时 内存占用
#1 Accepted 3ms 324.0 KiB
#2 Accepted 2ms 332.0 KiB
#3 Accepted 2ms 320.0 KiB
#4 Accepted 2ms 328.0 KiB
#5 Accepted 7ms 328.0 KiB
#6 Accepted 8ms 328.0 KiB
#7 Accepted 16ms 320.0 KiB
#8 Time Exceeded ≥1007ms ≥596.0 KiB
#9 Time Exceeded ≥1007ms ≥828.0 KiB
#10 Time Exceeded ≥1007ms ≥712.0 KiB

代码

#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
int ans[100001],n,a[100001],MAX=0;
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>='0'&&c<='9')
	{
		a=(a<<1)+(a<<3)+c-'0';
		c=getchar();
	}
	a*=k;
}
int main()
{
	//freopen("sort.in.txt","r",stdin);
	//freopen("sort.out.txt","w",stdout);
	int ai;
	read(n);
	for(int i=1;i<=n;i++)
	{
	    read(a[i]);
	    int MAX1=0;
	    for(int j=i-1;j>=1;j--)
	    {
	    	if(MAX1<ans[j]&&a[i]>=a[j])
	    	MAX1=ans[j];
		} 
		ans[i]=MAX1+1;
	    if(ans[i]>MAX)
	    	MAX=ans[i];
	}
	cout<<MAX<<endl;
	return 0;
}

信息

递交者
类型
递交
题目
序 T2
题目数据
下载
语言
C++
递交时间
2017-10-19 20:07:23
评测时间
2017-10-19 20:07:23
评测机
分数
70
总耗时
≥3064ms
峰值内存
≥828.0 KiB