제출 #1064232

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