This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "islands.h"
#include <variant>
#include <vector>
#include <iostream>
using namespace std;
#define ll int
#define F first
#define S second
#define pb push_back
#define sz(x) (ll)x.size()
#define endl "\n"
typedef vector <ll> vi;
typedef pair <ll, ll> ii;
typedef vector <ii> vii;
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
void printVct(vi &v){
for (ll i =0; i<sz(v); i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
ll n,m;
vi u,v;
variant<bool, vi> find_journey(int N, int M, vi U, vi V){
ll n = N, m = M;
u = U, v = V;
// printVct(u);
// printVct(v);
if (n == 2){
ll f0 = 0;
vi a(3,-1);
for (ll i =0; i<n; i++){
if (u[i]){
f0++;
if (a[0] == -1){
a[0] = i;
}
else if (a[1] == -1){
a[1] = i;
}
}
else if (a[2] == -1){
a[2] = i;
}
}
ll f1 = m-f0;
if (f0 >= 2 && f1 >= 1){
return vi({a[0], a[2], a[1], a[0], a[2], a[1]});
}
else{
return false;
}
}
return false;
}
/*
4 5
0 1
1 2
2 3
0 3
3 1
2 3
0 1
1 0
1 0
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |