Submission #1315606

#TimeUsernameProblemLanguageResultExecution timeMemory
1315606PlayVoltzThousands Islands (IOI22_islands)C++20
Compilation error
0 ms0 KiB
#include "islands.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second

variant<bool, vector<int> > find_journey(int n, int m, vector<int> u, vector<int> v){
	if (m<3)return false;
	vector<int> a, b;
	for (int i=0; i<m; ++i){
		if (v[i])a.pb(i);
		else b.pb(i);
	}
	if (a.empty()||b.empty())return false;
	if (a.size()>=2)return {a[0], b[0], a[1], a[0], b[0], a[1]};
	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:67: error: could not convert '{a.std::vector<int>::operator[](0), b.std::vector<int>::operator[](0), a.std::vector<int>::operator[](1), a.std::vector<int>::operator[](0), b.std::vector<int>::operator[](0), a.std::vector<int>::operator[](1)}' from '<brace-enclosed initializer list>' to 'std::variant<bool, std::vector<int, std::allocator<int> > >'
   19 |         if (a.size()>=2)return {a[0], b[0], a[1], a[0], b[0], a[1]};
      |                                                                   ^
      |                                                                   |
      |                                                                   <brace-enclosed initializer list>