Submission #1222165

#TimeUsernameProblemLanguageResultExecution timeMemory
1222165kargneqComparing Plants (IOI20_plants)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> r; int n; void init(int k, const vector<int>& rr) { r = rr; n = r.size(); } int compare_plants(int x, int y) { // Check if y is one of the next two plants after x (circularly) int n1 = (x + 1) % n; int n2 = (x + 2) % n; if (r[x] == 0 && (y == n1 || y == n2)) return 1; // x is definitely taller if (r[x] == 2 && (y == n1 || y == n2)) return -1; // x is definitely shorter // Check if x is one of the next two plants after y (circularly) int yn1 = (y + 1) % n; int yn2 = (y + 2) % n; if (r[y] == 0 && (x == yn1 || x == yn2)) return -1; // y is definitely taller if (r[y] == 2 && (x == yn1 || x == yn2)) return 1; // y is definitely shorter return 0; // inconclusive }

Compilation message (stderr)

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