제출 #786223

#제출 시각아이디문제언어결과실행 시간메모리
786223vjudge1수천개의 섬 (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> f0, f1; for (int i = 0; i < M; i++) { (U[i] == 0 ? f0 : f1).push_back(i); } if (f0.size() < 2 || f1.size() < 1) { return false; } return {f0[0], f1[0], f0[1], f0[0], f1[0], f0[1]}; }

컴파일 시 표준 에러 (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:53: error: could not convert '{f0.std::vector<int>::operator[](0), f1.std::vector<int>::operator[](0), f0.std::vector<int>::operator[](1), f0.std::vector<int>::operator[](0), f1.std::vector<int>::operator[](0), f0.std::vector<int>::operator[](1)}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   12 |     return {f0[0], f1[0], f0[1], f0[0], f1[0], f0[1]};
      |                                                     ^
      |                                                     |
      |                                                     <brace-enclosed initializer list>