제출 #154576

#제출 시각아이디문제언어결과실행 시간메모리
154576dolphingarlic지구 온난화 (NOI13_gw)C++14
6 / 40
35 ms4272 KiB
#include <bits/stdc++.h> #define FOR(i, x, y) for (int i = x; i < y; i++) typedef long long ll; using namespace std; int k[100001]; priority_queue<pair<int, int>> pq; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; FOR(i, 0, n) { cin >> k[i]; pq.push({k[i], i}); } int ans = 0, curr = 0; while (pq.size()) { int h, indx; tie(h, indx) = pq.top(); pq.pop(); if ((indx == 0 || h >= k[indx - 1]) && (indx == n - 1 || h > k[indx + 1])) curr++; else if ((indx != 0 && h < k[indx - 1]) && (indx != n - 1 && h < k[indx + 1])) curr--; ans = max(ans, curr); } cout << ans; return 0; }
#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...