Submission #1324630

#TimeUsernameProblemLanguageResultExecution timeMemory
1324630thondonGlobal Warming (NOI13_gw)C++17
Compilation error
0 ms0 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;
}

Compilation message (stderr)

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status