Submission #1012707

#TimeUsernameProblemLanguageResultExecution timeMemory
1012707bachhoangxuanThousands Islands (IOI22_islands)C++17
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>> e(N); for(int i=0;i<M;i++) e[U[i]].push_back(i); if((int)e[0].size()<2 || (int)e[1].size()<1) return false; return {e[0][0],e[1][0],e[0][1],e[0][0],e[1][0],e[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:10:60: error: could not convert '{(& e.std::vector<std::vector<int> >::operator[](0))->std::vector<int>::operator[](0), (& e.std::vector<std::vector<int> >::operator[](1))->std::vector<int>::operator[](0), (& e.std::vector<std::vector<int> >::operator[](0))->std::vector<int>::operator[](1), (& e.std::vector<std::vector<int> >::operator[](0))->std::vector<int>::operator[](0), (& e.std::vector<std::vector<int> >::operator[](1))->std::vector<int>::operator[](0), (& e.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> > >'
   10 |     return {e[0][0],e[1][0],e[0][1],e[0][0],e[1][0],e[0][1]};
      |                                                            ^
      |                                                            |
      |                                                            <brace-enclosed initializer list>