Submission #1037609

#TimeUsernameProblemLanguageResultExecution timeMemory
1037609thinknoexitThousands Islands (IOI22_islands)C++17
Compilation error
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] }; }

Compilation message (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>