Submission #1222189

#TimeUsernameProblemLanguageResultExecution timeMemory
1222189kargneqComparing Plants (IOI20_plants)C++20
Compilation error
0 ms0 KiB
#include <vector>
using namespace std;

vector<int> r, h;
int n, k;

void init(int kk, vector<int> rr, vector<int> hh) {
    k = kk;
    r = rr;
    h = hh;
    n = r.size();
}

// Returns 1 if h is consistent with r, 0 otherwise
int compare_plants() {
    for (int i = 0; i < n; ++i) {
        int cnt = 0;
        for (int j = 1; j < k; ++j) {
            int nxt = (i + j) % n;
            if (h[nxt] > h[i]) cnt++;
        }
        if (cnt != r[i]) {
            return 0;
        }
    }
    return 1;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc2BIzy1.o: in function `main':
grader.cpp:(.text.startup+0x2e9): undefined reference to `init(int, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x30f): undefined reference to `compare_plants(int, int)'
collect2: error: ld returned 1 exit status