제출 #676468

#제출 시각아이디문제언어결과실행 시간메모리
676468penguin133지구 온난화 (NOI13_gw)C++17
40 / 40
209 ms21400 KiB
#include <bits/stdc++.h> using namespace std; int exis[1000005]; pair<int, int>arr[1000005]; int main(){ ios::sync_with_stdio(0);cin.tie(0); int n; cin >> n; int ans = 0; for(int i=1;i<=n;i++){ cin >> arr[i].first; arr[i].second = i; } sort(arr+1, arr + n + 1); int cnt = 0; for(int i=n;i>=1;i--){ int cur = arr[i].second; exis[cur] = true; if(exis[cur-1] == true && exis[cur+1] == true)cnt--; else if(exis[cur-1] == false && exis[cur+1] == false)cnt++; if(i == 1 || arr[i].first != arr[i-1].first)ans = max(ans,cnt); } 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...