제출 #1074393

#제출 시각아이디문제언어결과실행 시간메모리
1074393fv3수천개의 섬 (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...