제출 #1037609

#제출 시각아이디문제언어결과실행 시간메모리
1037609thinknoexit수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; using ll = long long; vector<int> boat[2]; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { for (int i = 0;i < M;i++) boat[U[i]].push_back(i); if ((int)boat[0].size() < 2 || (int)boat[1].size() < 1) return false; return { boat[0][0], boat[1][0], boat[0][1], boat[0][0], boat[1][0], boat[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:9:85: error: could not convert '{boat[0].std::vector<int>::operator[](0), boat[1].std::vector<int>::operator[](0), boat[0].std::vector<int>::operator[](1), boat[0].std::vector<int>::operator[](0), boat[1].std::vector<int>::operator[](0), boat[0].std::vector<int>::operator[](1)}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
    9 |     return { boat[0][0], boat[1][0], boat[0][1], boat[0][0], boat[1][0], boat[0][1] };
      |                                                                                     ^
      |                                                                                     |
      |                                                                                     <brace-enclosed initializer list>