Submission #1190703

#TimeUsernameProblemLanguageResultExecution timeMemory
1190703AmrThousands Islands (IOI22_islands)C++20
Compilation error
0 ms0 KiB
#include "islands.h" #include <variant> #include <vector> #include<bits/stdc++.h> using namespace std; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { if(N==2) { vector<int> va,vb; for(int i = 0; i < M; i++) if(U[i]==0)va.push_back(i); else vb.push_back(i); if(va.size()>=2&&vb.size()>=1) { vector<int > ans; ll a1 = va[0], a2 = va[1], b = vb[0]; return vector<int>({a1,b,a2,a1,b,a2}); } else return false; } ll a1 , a2, b1 ,b2 , c1, c2; for(int i = 0; i < M; i++) { if(U[i]==0&&V[i]==1) a1 = i; if(U[i]==1&&V[i]==0) a2 = i; if(U[i]==1&&V[i]==2) b1 = i; if(U[i]==2&&V[i]==1) b2 = i; if(U[i]==2&&V[i]==0) c1 = i; if(U[i]==0&&V[i]==2) c2 = i; } return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2}); }

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:13: error: 'll' was not declared in this scope
   18 |             ll a1 = va[0], a2 = va[1], b = vb[0];
      |             ^~
islands.cpp:19:33: error: 'a1' was not declared in this scope; did you mean 'y1'?
   19 |             return vector<int>({a1,b,a2,a1,b,a2});
      |                                 ^~
      |                                 y1
islands.cpp:19:36: error: 'b' was not declared in this scope; did you mean 'vb'?
   19 |             return vector<int>({a1,b,a2,a1,b,a2});
      |                                    ^
      |                                    vb
islands.cpp:19:38: error: 'a2' was not declared in this scope
   19 |             return vector<int>({a1,b,a2,a1,b,a2});
      |                                      ^~
islands.cpp:19:49: error: no matching function for call to 'std::vector<int>::vector(<brace-enclosed initializer list>)'
   19 |             return vector<int>({a1,b,a2,a1,b,a2});
      |                                                 ^
In file included from /usr/include/c++/11/vector:67,
                 from islands.h:2,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:653:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]'
  653 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:653:9: note:   template argument deduction/substitution failed:
islands.cpp:19:49: note:   candidate expects 3 arguments, 1 provided
   19 |             return vector<int>({a1,b,a2,a1,b,a2});
      |                                                 ^
In file included from /usr/include/c++/11/vector:67,
                 from islands.h:2,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:625:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  625 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:625:43: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<int>'
  625 |       vector(initializer_list<value_type> __l,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:607:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  607 |       vector(vector&& __rv, const allocator_type& __m)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:607:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:589:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]'
  589 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:589:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:585:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]'
  585 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:585:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:575:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  575 |       vector(const vector& __x, const allocator_type& __a)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:575:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  572 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:572:14: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>&&'
  572 |       vector(vector&&) noexcept = default;
      |              ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:553:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  553 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:553:28: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>&'
  553 |       vector(const vector& __x)
      |              ~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:522:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  522 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:522:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:510:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:510:24: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |              ~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:497:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  497 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:497:36: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const allocator_type&' {aka 'const std::allocator<int>&'}
  497 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |              ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:487:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]'
  487 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:487:7: note:   candidate expects 0 arguments, 1 provided
islands.cpp:23:5: error: 'll' was not declared in this scope
   23 |     ll a1 , a2, b1 ,b2 , c1, c2;
      |     ^~
islands.cpp:26:30: error: 'a1' was not declared in this scope; did you mean 'y1'?
   26 |         if(U[i]==0&&V[i]==1) a1 = i;
      |                              ^~
      |                              y1
islands.cpp:27:30: error: 'a2' was not declared in this scope
   27 |         if(U[i]==1&&V[i]==0) a2 = i;
      |                              ^~
islands.cpp:28:30: error: 'b1' was not declared in this scope; did you mean 'y1'?
   28 |         if(U[i]==1&&V[i]==2) b1 = i;
      |                              ^~
      |                              y1
islands.cpp:29:30: error: 'b2' was not declared in this scope
   29 |         if(U[i]==2&&V[i]==1) b2 = i;
      |                              ^~
islands.cpp:30:30: error: 'c1' was not declared in this scope; did you mean 'y1'?
   30 |         if(U[i]==2&&V[i]==0) c1 = i;
      |                              ^~
      |                              y1
islands.cpp:31:30: error: 'c2' was not declared in this scope
   31 |         if(U[i]==0&&V[i]==2) c2 = i;
      |                              ^~
islands.cpp:33:25: error: 'a1' was not declared in this scope; did you mean 'y1'?
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                         ^~
      |                         y1
islands.cpp:33:28: error: 'b1' was not declared in this scope; did you mean 'y1'?
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                            ^~
      |                            y1
islands.cpp:33:31: error: 'c1' was not declared in this scope; did you mean 'y1'?
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                               ^~
      |                               y1
islands.cpp:33:34: error: 'c2' was not declared in this scope
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                                  ^~
islands.cpp:33:37: error: 'b2' was not declared in this scope
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                                     ^~
islands.cpp:33:40: error: 'a2' was not declared in this scope
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                                        ^~
islands.cpp:33:61: error: no matching function for call to 'std::vector<int>::vector(<brace-enclosed initializer list>)'
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                                                             ^
In file included from /usr/include/c++/11/vector:67,
                 from islands.h:2,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:653:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]'
  653 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:653:9: note:   template argument deduction/substitution failed:
islands.cpp:33:61: note:   candidate expects 3 arguments, 1 provided
   33 |     return vector<int>({a1,b1,c1,c2,b2,a2,c1,b1,a1,a2,b2,c2});
      |                                                             ^
In file included from /usr/include/c++/11/vector:67,
                 from islands.h:2,
                 from islands.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:625:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  625 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:625:43: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<int>'
  625 |       vector(initializer_list<value_type> __l,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:607:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  607 |       vector(vector&& __rv, const allocator_type& __m)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:607:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:589:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]'
  589 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:589:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:585:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]'
  585 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:585:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:575:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  575 |       vector(const vector& __x, const allocator_type& __a)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:575:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  572 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:572:14: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>&&'
  572 |       vector(vector&&) noexcept = default;
      |              ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:553:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  553 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:553:28: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>&'
  553 |       vector(const vector& __x)
      |              ~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:522:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  522 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:522:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/11/bits/stl_vector.h:510:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:510:24: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
  510 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |              ~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:497:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]'
  497 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:497:36: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const allocator_type&' {aka 'const std::allocator<int>&'}
  497 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |              ~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:487:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]'
  487 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/11/bits/stl_vector.h:487:7: note:   candidate expects 0 arguments, 1 provided