Submission #1182324

#TimeUsernameProblemLanguageResultExecution timeMemory
1182324PagodePaivaThousands Islands (IOI22_islands)C++20
Compilation error
0 ms0 KiB
#include "islands.h" #include<bits/stdc++.h> #include <variant> #include <vector> const int N = 100010; vector <pair <int, int>> g[N]; 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++){ g[U[i]].push_back({V[i], i}); } if(g[0].size() < 2) return false; if(g[1].size() < 1) return false; int a = g[0][0].second, b = g[0][1].second, c = g[1][0].second; return {a, c, b, a, c, b}; /* if (N == 4) { return std::vector<int>({0, 1, 2, 4, 0, 3, 2, 1, 4, 3}); } return false; */ }

Compilation message (stderr)

islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:9: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    7 | vector <pair <int, int>> g[N];
      |         ^~~~
      |         std::pair
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/variant:37,
                 from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
islands.cpp:7:1: error: 'vector' does not name a type
    7 | vector <pair <int, int>> g[N];
      | ^~~~~~
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: 'g' was not declared in this scope
   12 |     g[U[i]].push_back({V[i], i});
      |     ^
islands.cpp:14:6: error: 'g' was not declared in this scope
   14 |   if(g[0].size() < 2) return false;
      |      ^
islands.cpp:15:6: error: 'g' was not declared in this scope
   15 |   if(g[1].size() < 1) return false;
      |      ^
islands.cpp:16:11: error: 'g' was not declared in this scope
   16 |   int a = g[0][0].second, b = g[0][1].second, c = g[1][0].second;
      |           ^
islands.cpp:17:14: error: 'c' was not declared in this scope
   17 |   return {a, c, b, a, c, b};
      |              ^
islands.cpp:17:17: error: 'b' was not declared in this scope
   17 |   return {a, c, b, a, c, b};
      |                 ^
islands.cpp:17:27: error: could not convert '{a, <expression error>, <expression error>, a, c, b}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   17 |   return {a, c, b, a, c, b};
      |                           ^
      |                           |
      |                           <brace-enclosed initializer list>