| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1352448 | kawhiet | 지구 온난화 (NOI13_gw) | C++20 | 126 ms | 8268 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<array<int, 2>> h(n);
for (int i = 0; i < n; i++) {
cin >> h[i][0];
h[i][1] = i;
}
sort(h.rbegin(), h.rend());
vector<bool> vis(n);
int ans = 0, s = 0;
for (int i = 0; i < n; i++) {
int x = h[i][0];
while (i < n && h[i][0] == x) {
int j = h[i][1];
bool ok = true;
if (j > 0 && vis[j - 1]) ok = false;
if (j + 1 < n && vis[j + 1]) ok = false;
if (ok) {
s++;
}
if (j > 0 && j < n - 1 && vis[j - 1] && vis[j + 1]) {
s--;
}
vis[j] = 1;
i++;
}
ans = max(ans, s);
}
cout << ans << '\n';
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
