제출 #1228785

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

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