Submission #1228785

#TimeUsernameProblemLanguageResultExecution timeMemory
1228785ericl23302Thousands Islands (IOI22_islands)C++20
Compilation error
0 ms0 KiB
#include "islands.h" #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) { vector<vector<int>> boats(2); for (int i = 0; i < M; ++i) boats[U[i]].push_back(i); if (boats[0].size() < 2 || boats[1].size() < 1) return false; return {boats[0][0], boats[1][0], boats[0][1], boats[0][0], boats[1][0], boats[0][1]}; }

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:11:89: error: could not convert '{(& boats.std::vector<std::vector<int> >::operator[](0))->std::vector<int>::operator[](0), (& boats.std::vector<std::vector<int> >::operator[](1))->std::vector<int>::operator[](0), (& boats.std::vector<std::vector<int> >::operator[](0))->std::vector<int>::operator[](1), (& boats.std::vector<std::vector<int> >::operator[](0))->std::vector<int>::operator[](0), (& boats.std::vector<std::vector<int> >::operator[](1))->std::vector<int>::operator[](0), (& boats.std::vector<std::vector<int> >::operator[](0))->std::vector<int>::operator[](1)}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   11 |     return {boats[0][0], boats[1][0], boats[0][1], boats[0][0], boats[1][0], boats[0][1]};
      |                                                                                         ^
      |                                                                                         |
      |                                                                                         <brace-enclosed initializer list>