제출 #1353269

#제출 시각아이디문제언어결과실행 시간메모리
1353269vako_p지구 온난화 (NOI13_gw)C++20
19 / 40
702 ms113712 KiB
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define ff first
#define sd second
#define debug(x) cerr << #x << " ----> " << x << endl;

const int mxN = 1e6 + 5;
ll n,a[mxN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	map<ll,vector<ll>> mp;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		mp[a[i]].pb(i);
	}
	ll ans = 1,curr = 1;
	for(auto v : mp){
		for(auto i : v.sd){
			curr--;
			if(i < n and a[i] <= a[i + 1]) curr++;
			if(i > 1 and a[i] < a[i - 1]) curr++;
		}
		ans = max(ans, curr);
	}
	cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...