Submission #647078

#TimeUsernameProblemLanguageResultExecution timeMemory
647078georgievskiypopa (BOI18_popa)C++17
Compilation error
0 ms0 KiB
// #include "popa.h"; #include <bits/stdc++.h> using namespace std; int rec(int l, int r, int* left, int* right) { if (l >= r) return -1; if (l + 1 == r) return l; int root; for (int i = l; i < r; i++) { if (query(l, r + 1, i, i)) { root = i; break; } } int l_c = rec(l, root, left, right); int r_c = rec(root + 1, r, left, right); left[root] = l_c, right[root] = r_c; } int solve(int n, int* left, int* right) { fill(left, left + n, -1), fill(right, right + n, -1); return rec(l, r, left, right); }

Compilation message (stderr)

popa.cpp: In function 'int rec(int, int, int*, int*)':
popa.cpp:13:7: error: 'query' was not declared in this scope
   13 |   if (query(l, r + 1, i, i)) {
      |       ^~~~~
popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:25:13: error: 'l' was not declared in this scope
   25 |  return rec(l, r, left, right);
      |             ^
popa.cpp:25:16: error: 'r' was not declared in this scope
   25 |  return rec(l, r, left, right);
      |                ^
popa.cpp: In function 'int rec(int, int, int*, int*)':
popa.cpp:20:32: warning: control reaches end of non-void function [-Wreturn-type]
   20 |  left[root] = l_c, right[root] = r_c;
      |                    ~~~~~~~~~~~~^~~~~