Submission #1324629

#TimeUsernameProblemLanguageResultExecution timeMemory
1324629thondon지구 온난화 (NOI13_gw)C++17
0 / 40
1 ms332 KiB
#include <bits/stdc++.h>
using namespace std;

bitset<1000002> stat = 0;

int gw(int N, int *H)
{
    int result = 0, x, answer = 0;

    vector<pair<int, int>> v;
    for (int i = 1; i <= N; ++i)
    {
        v.push_back({H[i], i});
    }

    sort(v.begin(), v.end());

    x = v.back().first;

    while (v.size() > 0)
    {
        while (v.back().first == x)
        {
            stat[v.back().second] = 1;
            if (stat[v.back().second - 1] == 1 && stat[v.back().second + 1] == 1)
                result--;
            if (stat[v.back().second - 1] == 0 && stat[v.back().second + 1] == 0)
                result++;
            v.pop_back();
        }

        answer = max(answer, result);

        x = v.back().first;
    }

    return answer;
}

signed main(void)
{
    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...