Submission #745230

#TimeUsernameProblemLanguageResultExecution timeMemory
745230math_rabbit_1028Thousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h" #include <bits/stdc++.h> int n, m; vector<int> adj[101010]; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { n = N; m = M; for (int i = 0; i < m; i++) { adj[U[i]].push_back(V[i]); adj[V[i]].push_back(U[i]); } if (adj[0].size() > 0) { vector<int> ret; ret.push_back(0); ret.push_back(adj[0][0]); ret.push_back(0); return ret; } return false; }

Compilation message (stderr)

islands.cpp:6:1: error: 'vector' does not name a type
    6 | vector<int> adj[101010];
      | ^~~~~~
islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:12:5: error: 'adj' was not declared in this scope
   12 |     adj[U[i]].push_back(V[i]);
      |     ^~~
islands.cpp:15:7: error: 'adj' was not declared in this scope
   15 |   if (adj[0].size() > 0) {
      |       ^~~
islands.cpp:16:5: error: 'vector' was not declared in this scope
   16 |     vector<int> ret;
      |     ^~~~~~
islands.cpp:16:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from islands.h:2,
                 from islands.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from islands.h:2,
                 from islands.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
islands.cpp:16:12: error: expected primary-expression before 'int'
   16 |     vector<int> ret;
      |            ^~~
islands.cpp:17:5: error: 'ret' was not declared in this scope
   17 |     ret.push_back(0);
      |     ^~~