제출 #825479

#제출 시각아이디문제언어결과실행 시간메모리
825479Liudas수천개의 섬 (IOI22_islands)C++17
8.40 / 100
30 ms6088 KiB
#include "islands.h" #include <cassert> #include <fstream> #include <cstdio> #include <variant> #include <vector> #include <map> #include <set> #include <queue> #include <unordered_set> #include <algorithm> #include <iostream> using namespace std; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { vector<queue<int>> tree(N); for(int i = 0; i < M; i ++){ tree[U[i]].push(V[i]); } vector<int> path, vis(N, 0); path.push_back(0); while(path.size()){ vis[path.back()] = true; if(tree[path.back()].size()){ int a = tree[path.back()].front(); tree[path.back()].pop(); path.push_back(a); if(vis[path.back()])break; } else{ vis[path.back()] = false; path.pop_back(); } } if(path.size()){ return path; } 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...