| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1029448 | rsinventor | Global Warming (NOI13_gw) | C++17 | 186 ms | 21332 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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.begin(), sh2.end());
    int mx_islands = 0;
    int islands = 0;
    for(int i = 0; i < n; i++) {
        if(max(0, h[i])>0 && (i==0 || max(0, h[i-1])==0)) islands++;
    }
    mx_islands = max(mx_islands, islands);
    for(int i = 0; i < sh2.size(); i++) {
        int s = sh2[i].second;
        if(h[s]!=h[s-1]) { islands++; }
        if(h[s+1]<h[s]) {
            islands--;
        } else if(h[s-1]<h[s]) {
            islands--;
        }
        mx_islands = max(mx_islands, islands);
    }
    cout << mx_islands << endl;
    return 0;
}
Compilation message (stderr)
| # | 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... | ||||
