Submission #728560

#TimeUsernameProblemLanguageResultExecution timeMemory
728560groguThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h" #define dbg(x) cerr<<#x<<": "<<x<<endl #define ll int #define pll pair<ll,ll> #include <iostream> #include <vector> #include <variant> #define pb push_back using namespace std; #define maxn 405 ll n,m; vector<ll> g[maxn]; ll id[maxn][maxn]; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { n = N; m = M; variant<bool,vector<int>> ans(n&1); return ans; for(ll i = 0;i<m;i++){ ll x = U[i],y = V[i]; x++; y++; g[x].pb(y); g[y].pb(x); id[x][y] = i; } }

Compilation message (stderr)

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:18:38: error: no matching function for call to 'std::variant<bool, std::vector<int, std::allocator<int> > >::variant(int)'
   18 |     variant<bool,vector<int>> ans(n&1);
      |                                      ^
In file included from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/10/variant:1402:2: note: candidate: 'template<long unsigned int _Np, class _Up, class ... _Args, class _Tp, class> constexpr std::variant<_Types>::variant(std::in_place_index_t<_Np>, std::initializer_list<_Up>, _Args&& ...) [with long unsigned int _Np = _Np; _Up = _Up; _Args = {_Args ...}; _Tp = _Tp; <template-parameter-2-5> = <template-parameter-1-5>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1402 |  variant(in_place_index_t<_Np>, initializer_list<_Up> __il,
      |  ^~~~~~~
/usr/include/c++/10/variant:1402:2: note:   template argument deduction/substitution failed:
islands.cpp:18:38: note:   mismatched types 'std::in_place_index_t<_Idx>' and 'int'
   18 |     variant<bool,vector<int>> ans(n&1);
      |                                      ^
In file included from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/10/variant:1391:2: note: candidate: 'template<long unsigned int _Np, class ... _Args, class _Tp, class> constexpr std::variant<_Types>::variant(std::in_place_index_t<_Np>, _Args&& ...) [with long unsigned int _Np = _Np; _Args = {_Args ...}; _Tp = _Tp; <template-parameter-2-4> = <template-parameter-1-4>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1391 |  variant(in_place_index_t<_Np>, _Args&&... __args)
      |  ^~~~~~~
/usr/include/c++/10/variant:1391:2: note:   template argument deduction/substitution failed:
islands.cpp:18:38: note:   mismatched types 'std::in_place_index_t<_Idx>' and 'int'
   18 |     variant<bool,vector<int>> ans(n&1);
      |                                      ^
In file included from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/10/variant:1381:2: note: candidate: 'template<class _Tp, class _Up, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_type_t<_Tp>, std::initializer_list<_Up>, _Args&& ...) [with _Tp = _Tp; _Up = _Up; _Args = {_Args ...}; <template-parameter-2-4> = <template-parameter-1-4>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1381 |  variant(in_place_type_t<_Tp>, initializer_list<_Up> __il,
      |  ^~~~~~~
/usr/include/c++/10/variant:1381:2: note:   template argument deduction/substitution failed:
islands.cpp:18:38: note:   mismatched types 'std::in_place_type_t<_Tp>' and 'int'
   18 |     variant<bool,vector<int>> ans(n&1);
      |                                      ^
In file included from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/10/variant:1371:2: note: candidate: 'template<class _Tp, class ... _Args, class> constexpr std::variant<_Types>::variant(std::in_place_type_t<_Tp>, _Args&& ...) [with _Tp = _Tp; _Args = {_Args ...}; <template-parameter-2-3> = <template-parameter-1-3>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1371 |  variant(in_place_type_t<_Tp>, _Args&&... __args)
      |  ^~~~~~~
/usr/include/c++/10/variant:1371:2: note:   template argument deduction/substitution failed:
islands.cpp:18:38: note:   mismatched types 'std::in_place_type_t<_Tp>' and 'int'
   18 |     variant<bool,vector<int>> ans(n&1);
      |                                      ^
In file included from islands.h:1,
                 from islands.cpp:1:
/usr/include/c++/10/variant:1361:2: note: candidate: 'template<class _Tp, class, class, class _Tj, class> constexpr std::variant<_Types>::variant(_Tp&&) [with _Tp = _Tp; <template-parameter-2-2> = <template-parameter-1-2>; <template-parameter-2-3> = <template-parameter-1-3>; _Tj = _Tj; <template-parameter-2-5> = <template-parameter-1-5>; _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1361 |  variant(_Tp&& __t)
      |  ^~~~~~~
/usr/include/c++/10/variant:1361:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/variant: In substitution of 'template<class ... _Types> template<class _Tp, class> using __accepted_type = std::variant<_Types>::__to_type<__accepted_index<_Tp> > [with _Tp = int&&; <template-parameter-2-2> = void; _Types = {bool, std::vector<int, std::allocator<int> >}]':
/usr/include/c++/10/variant:1357:9:   required from here
/usr/include/c++/10/variant:1327:8: error: no type named 'type' in 'struct std::enable_if<false, void>'
 1327 |  using __accepted_type = __to_type<__accepted_index<_Tp>>;
      |        ^~~~~~~~~~~~~~~
/usr/include/c++/10/variant:1349:7: note: candidate: 'std::variant<_Types>::variant(std::variant<_Types>&&) [with _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1349 |       variant(variant&&) = default;
      |       ^~~~~~~
/usr/include/c++/10/variant:1349:15: note:   no known conversion for argument 1 from 'int' to 'std::variant<bool, std::vector<int, std::allocator<int> > >&&'
 1349 |       variant(variant&&) = default;
      |               ^~~~~~~~~
/usr/include/c++/10/variant:1348:7: note: candidate: 'std::variant<_Types>::variant(const std::variant<_Types>&) [with _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1348 |       variant(const variant& __rhs) = default;
      |       ^~~~~~~
/usr/include/c++/10/variant:1348:30: note:   no known conversion for argument 1 from 'int' to 'const std::variant<bool, std::vector<int, std::allocator<int> > >&'
 1348 |       variant(const variant& __rhs) = default;
      |               ~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/10/variant:1347:7: note: candidate: 'constexpr std::variant<_Types>::variant() [with _Types = {bool, std::vector<int, std::allocator<int> >}]'
 1347 |       variant() = default;
      |       ^~~~~~~
/usr/include/c++/10/variant:1347:7: note:   candidate expects 0 arguments, 1 provided