Submission #1053656

#TimeUsernameProblemLanguageResultExecution timeMemory
1053656IgnutThousands Islands (IOI22_islands)C++17
0 / 100
16 ms6008 KiB
/* Ignut
started: 11.08.2024
now: 11.08.2024
████████████████████████████████████████████████████████████████████
████████████████████████████████    ████████████████████████████████
██████████████████████████████        ██████████████████████████████
██████      ██████████████████        ██████████████████      ██████
██████          ██████████████        ██████████████          ██████
██████      ██    ████████████        ████████████    ██      ██████
██████      ████    ██████████        ██████████    ████      ██████
██████      ████      ██████████    ██████████      ████      ██████
██████      ████      ██████████    ██████████    ██████      ██████
██████      ██████    ██████████    ██████████    ██████      ██████
██████      ██████    ████████        ████████    ██████      ██████
██████      ██████      ██████        ██████      ██████      ██████
██████      ████        ████            ████        ████      ██████
██████            ██████████    ████    ██████████            ██████
██████      ██      ██████    ████████    ██████      ██      ██████
██████      ██████            ████████            ██████      ██████
██████                    ██            ██                    ██████
██████████████████████      ████    ████      ██████████████████████
████████████████████████      ██    ██      ████████████████████████
██████████████████████████                ██████████████████████████
██████████████████████████████        ██████████████████████████████
████████████████████████████████████████████████████████████████████
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int MAXN = 1e5 + 123;
int n;

vector<int> g[MAXN];
bool used[MAXN];

vector<int> order;

int cycle_start = -1;

void dfs(int v) {
    if (cycle_start != -1) return;
    used[v] = true;
    order.push_back(v);
    for (int to : g[v]) {
        if (used[to]) {
            cycle_start = to;
            break;
        }
        dfs(to);
    }
}

variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) {
    n = N;
    for (int i = 0; i < M; i += 2) {
        g[U[i]].push_back(V[i]);
    }
    dfs(0);
    return (cycle_start == -1 ? false : true);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...