Submission #1182325

#TimeUsernameProblemLanguageResultExecution timeMemory
1182325PagodePaivaThousands Islands (IOI22_islands)C++20
Compilation error
0 ms0 KiB
#include "islands.h" #include<bits/stdc++.h> #include <variant> #include <vector> using namespace std; const int N = 100010; vector <pair <int, int>> g[N]; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { for(int i = 0;i < M;i++){ g[U[i]].push_back({V[i], i}); } if(g[0].size() < 2) return false; if(g[1].size() < 1) return false; int a = g[0][0].second, b = g[0][1].second, c = g[1][0].second; return {a, c, b, a, c, b}; /* if (N == 4) { return std::vector<int>({0, 1, 2, 4, 0, 3, 2, 1, 4, 3}); } return false; */ }

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:19:27: error: could not convert '{a, c, b, a, c, b}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   19 |   return {a, c, b, a, c, b};
      |                           ^
      |                           |
      |                           <brace-enclosed initializer list>