Submission #814573

#TimeUsernameProblemLanguageResultExecution timeMemory
814573LIFThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h" #include<bits/stdc++.h> #include <variant> #include <vector> int ind[300005]; int ph[1005][1005]; vector<int> vv[300005]; using namespace std; bool can[300005]; void dfs(int now,int fa) { can[now] = true; for(int i=0;i<vv[now].size();i++) { int go = vv[now][i]; if(go != fa)dfs(go,now); } } std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { for(int i=0;i<M;i++) { vv[U[i]].push_back(V[i]); vv[V[i]].push_back(U[i]); ind[U[i]]++; ind[V[i]]++; } dfs(0); if(ind[0] >= 2)return true; for(int i=1;i<N;i++) { if(ind[i] >= 3 && can[go] == true)return true; } /* if (N == 4) { return std::vector<int>({0, 1, 2, 4, 0, 3, 2, 1, 4, 3}); } return false;*/ return true; }

Compilation message (stderr)

islands.cpp:7:1: error: 'vector' does not name a type
    7 | vector<int> vv[300005];
      | ^~~~~~
islands.cpp: In function 'void dfs(int, int)':
islands.cpp:13:17: error: 'vv' was not declared in this scope
   13 |   for(int i=0;i<vv[now].size();i++)
      |                 ^~
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:23:5: error: 'vv' was not declared in this scope
   23 |     vv[U[i]].push_back(V[i]);
      |     ^~
islands.cpp:28:8: error: too few arguments to function 'void dfs(int, int)'
   28 |   dfs(0);
      |        ^
islands.cpp:10:6: note: declared here
   10 | void dfs(int now,int fa)
      |      ^~~
islands.cpp:32:28: error: 'go' was not declared in this scope
   32 |      if(ind[i] >= 3 && can[go] == true)return true;
      |                            ^~