Submission #1074393

#TimeUsernameProblemLanguageResultExecution timeMemory
1074393fv3Thousands Islands (IOI22_islands)C++17
0 / 100
21 ms5552 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; vector<vector<pair<int, int>>> adj; vector<int> res, visited; bool ok; void DFS(int index) { visited[index] = 1; for (auto node : adj[index]) { if (visited[node.first]) { ok = true; return; } DFS(node.first); } } variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { adj = vector<vector<pair<int, int>>>(N); res = vector<int>(); for (int i = 0; i < M; i += 2) { adj[U[i]].push_back({V[i], i}); } ok = false; visited = vector<int>(N); DFS(0); if (ok) return vector<int>({0}); return false; }
#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...