Submission #867529

#TimeUsernameProblemLanguageResultExecution timeMemory
867529pizzamoegerpopa (BOI18_popa)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "popa.h" int solve(int N, int* Left, int* Right) { vector<int> parent (N, -1); for (int i = 0; i < N; i++) { Left[i] = -1; Right[i] = -1; } int rl = 0; for (int i = 1; i < N; i++) { int v = rl; while(parent[v] != -1 && query(i, i, i, v)) { v = parent[v]; } if (parent[v] == -1) { if (query(i, i, i, v)) { parent[v] = i; Left[i] = v; rl = i; } else { parent[i] = v; Left[i] = Right[v]; Right[v] = i; rl = i; } } else { parent[i] = v; Left[i] = Right[v]; Right[v] = i; rl = i; } } int root = rl; while (parent[root] != -1) root = parent[root]; return root; } /*signed main() { const int N = 6; int* Left = new int[N]; int* Right = new int[N]; int ret = solve(N, Left, Right); cerr << ret; for (int i = 0; i < N; i++) { cout << Left[i] << " " << Right[i] << "\n"; } return 0; }*/

Compilation message (stderr)

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:5:2: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    5 |  vector<int> parent (N, -1);
      |  ^~~~~~
      |  std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from popa.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
popa.cpp:5:9: error: expected primary-expression before 'int'
    5 |  vector<int> parent (N, -1);
      |         ^~~
popa.cpp:15:9: error: 'parent' was not declared in this scope
   15 |   while(parent[v] != -1 && query(i, i, i, v)) {
      |         ^~~~~~
popa.cpp:19:7: error: 'parent' was not declared in this scope
   19 |   if (parent[v] == -1) {
      |       ^~~~~~
popa.cpp:39:9: error: 'parent' was not declared in this scope
   39 |  while (parent[root] != -1) root = parent[root];
      |         ^~~~~~