제출 #1059567

#제출 시각아이디문제언어결과실행 시간메모리
1059567shiomusubi496수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include "islands.h" #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i) #define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i) #define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i) #define all(v) begin(v), end(v) #define rall(v) rbegin(v), rend(v) using namespace std; using ll = long long; template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; } template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; } struct edge { int to, idx; }; using Graph = vector<vector<edge>>; std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> U, std::vector<int> V) { vector<vector<int>> A(N, vector<int>(N, -1)); rep (i, M) A[U[i]][V[i]] = i; if (N == 2) return false; return {A[0][1], A[1][0], A[0][2], A[2][0], A[1][0], A[0][1], A[2][0], A[0][2]}; }

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