Submission #749728

#TimeUsernameProblemLanguageResultExecution timeMemory
749728mohav48173Thousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h" #include<bits/stdc++.h> using namespace std; variant<bool, vector<int>> find_journey(int N, int M, vector<int> u, vector<int> v) { vector<int>first,second; for(int i=0;i<M;i++) { if(u[i]==0 && v[i]==1)first.push_back(i); else second.push_back(i); } if(first.size()>1 && second.size()>0) { return {first[0],second[0],first[1],first[0],second[0],first[1]}; } else return false; }

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