# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
632103 | Minindu2006 | Thousands Islands (IOI22_islands) | C++17 | 0 ms | 0 KiB |
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<bits/stdc++.h>
#include <variant>
#include <vector>
using namespace std;
int n, m, can = -1;
vector<int> u, v;
vector<int> adj[1001];
void dfs(int node, vector<int> &ans);
std::variant<bool, std::vector<int>> find_journey(
int N, int M, std::vector<int> U, std::vector<int> V) {
n = N, m = M;
U = u, v = V;
if(m <= 2)
return 0;
int z = 0;
vector<int> cur(3);
for(int i=0;i<m;i++)
{
if(u[i] == 0)
{
if(z < 2)
cur[z] = i;
z++;
}
else
cur[2] = i;
}
if(z <= 1)
return 0;
for(int i=0;i<3;i++)
cur.push_back(cur[i]);
return cur;
}