# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015722 | inesfi | Thousands Islands (IOI22_islands) | C++17 | 22 ms | 8192 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<M; n+=2){
noeudsAdj[U[n]].push_back(V[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... |