# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1029457 | 2024-07-20T22:25:04 Z | rsinventor | Global Warming (NOI13_gw) | C++17 | 166 ms | 29592 KB |
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); // freopen("warming.in", "r", stdin); // freopen("warming.out", "w", stdout); int n; cin >> n; int h[n]; vector<pair<int, int>> sh2(n); for(int i = 0; i < n; i++) { cin >> h[i]; sh2[i].first = h[i]; sh2[i].second = i; } sort(sh2.rbegin(), sh2.rend()); int mx_islands = 0; int islands = 0; vector<bool> visited(n); mx_islands = max(mx_islands, islands); for(int i = 0; i < sh2.size(); i++) { int s = sh2[i].second; islands++; visited[s] = true; if(visited[s+1]) { islands--; } if(visited[s-1]) { islands--; } if(i==n-1 || sh2[i].first!=sh2[i+1].first) { mx_islands = max(mx_islands, islands); } } cout << mx_islands << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 3172 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 3420 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 161 ms | 29592 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 166 ms | 29264 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |