Submission #5007

# Submission time Handle Problem Language Result Execution time Memory
5007 2014-01-26T05:01:38 Z cki86201 Global Warming (NOI13_gw) C++
40 / 40
448 ms 9876 KB
#include<stdio.h>
#include<algorithm>

int inp[1000010], ord[1000010];
bool chk[1000010];

bool comp(const int &a,const int &b){return inp[a]<inp[b];}

int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",inp+i), ord[i] = i;
	std::sort(ord+1,ord+1+n,comp);
	int now=1,ans=1;
	chk[0]=chk[n+1]=1;
	for(i=1;i<=n;i++){
		int t = ord[i];
		now+=1-chk[t-1]-chk[t+1];
		chk[t]=1;
		if(i==n || inp[t]!=inp[ord[i+1]])ans=std::max(ans,now);
	}
	printf("%d",ans);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9876 KB Output is correct
2 Correct 0 ms 9876 KB Output is correct
3 Correct 0 ms 9876 KB Output is correct
4 Correct 0 ms 9876 KB Output is correct
5 Correct 0 ms 9876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 9876 KB Output is correct
2 Correct 20 ms 9876 KB Output is correct
3 Correct 20 ms 9876 KB Output is correct
4 Correct 20 ms 9876 KB Output is correct
5 Correct 20 ms 9876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 9876 KB Output is correct
2 Correct 24 ms 9876 KB Output is correct
3 Correct 28 ms 9876 KB Output is correct
4 Correct 32 ms 9876 KB Output is correct
5 Correct 32 ms 9876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 440 ms 9876 KB Output is correct
2 Correct 432 ms 9876 KB Output is correct
3 Correct 444 ms 9876 KB Output is correct
4 Correct 432 ms 9876 KB Output is correct
5 Correct 428 ms 9876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 432 ms 9876 KB Output is correct
2 Correct 448 ms 9876 KB Output is correct
3 Correct 424 ms 9876 KB Output is correct
4 Correct 252 ms 9876 KB Output is correct
5 Correct 248 ms 9876 KB Output is correct