Submission #825479

#TimeUsernameProblemLanguageResultExecution timeMemory
825479LiudasThousands Islands (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...