# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015720 | inesfi | Thousands Islands (IOI22_islands) | C++17 | 19 ms | 6748 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>
using namespace std;
const int MAXI = 100*1000;
vector<int> noeudsAdj[MAXI];
const int PAS_VU = 0;
const int EN_COURS_DE_VISITE = 1;
const int DEJA_VISITE = 2;
int noeudVisite[MAXI];
bool TrouveCycle(int noeud)
{
if (noeudVisite[noeud] == DEJA_VISITE)
return false;
if (noeudVisite[noeud] == EN_COURS_DE_VISITE)
return true;
noeudVisite[noeud] = EN_COURS_DE_VISITE;
for (int arc = 0; arc < noeudsAdj[noeud].size(); arc++)
if (TrouveCycle(noeudsAdj[noeud][arc]))
return true;
noeudVisite[noeud] = DEJA_VISITE;
return false;
}
variant<bool, vector<int>> find_journey(
int N, int M, vector<int> U, vector<int> V) {
for(int n=0; n<N; n++){
noeudsAdj[U[n]].push_back(V[n]);
noeudsAdj[V[n]].push_back(U[n]);
}
return TrouveCycle(0);
}
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... |