제출 #749728

#제출 시각아이디문제언어결과실행 시간메모리
749728mohav48173수천개의 섬 (IOI22_islands)C++17
컴파일 에러
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; }

컴파일 시 표준 에러 (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>