Submission #1076444

#TimeUsernameProblemLanguageResultExecution timeMemory
1076444zsomborThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h" #include <bits/stdc++.h> #include <variant> using namespace std; int n, m; vector<int> u; vector<int> v; vector<int> ans; void solve1() { vector<int> a; vector<int> b; for (int i = 0; i < m; i++) { if (!u[i]) b.push_back(i); else a.push_back(i); } if (a.size() < 2 || b.size() < 2) return; ans = {a[0], b[0], a[1], b[1], b[0], a[0], b[1], a[1]}; } variant<bool, vector<int> > find_journey(int N, int M, vector<int> U, vector<int> V) { n = N; m = M; u = U; v = V; if (n == 2) solve1(); return (ans.size() ? ans : 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:28:24: error: operands to '?:' have different types 'std::vector<int>' and 'bool'
   28 |     return (ans.size() ? ans : false);
      |             ~~~~~~~~~~~^~~~~~~~~~~~~