Submission #41543

# Submission time Handle Problem Language Result Execution time Memory
41543 2018-02-18T17:11:02 Z wzy Global Warming (NOI13_gw) C++11
0 / 40
630 ms 32768 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
int ans = 0;
int n;
int v[1000005];
vector<pair<int,int> > cut;
int mark[1000005];
bool removed[1000005];
int main(){
	cin>>n;
	for(int i = 0 ; i < n;i++){
		cin>>v[i];
		mark[i] = 0;
		cut.pb(pair<int,int> ( v[i] , i));
	}
	int maxi = 1;
	sort(cut.begin() , cut.end());
	for(int i = 0 ; i <n ;i ++){
		maxi = max(maxi ,ans);
		int u = cut[i].second;
		removed[u] = true;
		if(mark[u]) ans--;
		if(u){
			mark[u-1]++;
			if(mark[u-1] == 1 && !removed[u-1])
				ans++;
		}
		if(u < n - 1){
			mark[u+1]++;
			if(mark[u+1] == 1 && !removed[u+1]){
				ans++;
			}
		}
		maxi = max(maxi ,ans);
	}
	cout<<maxi<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 2488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 3500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 630 ms 27988 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 627 ms 32768 KB Output isn't correct
2 Halted 0 ms 0 KB -