# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
830799 | tolbi | Thousands Islands (IOI22_islands) | C++17 | 32 ms | 5300 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 <bits/stdc++.h>
using namespace std;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#include "islands.h"
variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) {
vector<vector<pair<int,int>>> arr(N);
for (int i = 0; i < M; ++i)
{
arr[U[i]].push_back({V[i],i});
}
vector<int> ansarr;
vector<bool> vis(N,false);
auto dfs = [&](int node, auto dfs)->bool{
if (vis[node]) return true;
vis[node]=true;
ansarr.push_back(node);
for (int i = 0; i < arr[node].size(); i++){
if (dfs(arr[node][i].first,dfs)) return true;
}
ansarr.pop_back();
return false;
};
if (!dfs(0,dfs)) return false;
return true;
}
Compilation message (stderr)
# | 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... |