Submission #1009872

#TimeUsernameProblemLanguageResultExecution timeMemory
1009872dimashhhStations (IOI20_stations)C++17
0 / 100
581 ms10072 KiB
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 12; vector<int> g[N],ord; bool vis[N]; void dfs(int v){ vis[v] = 1; for(int to:g[v]){ if(!vis[to]){ dfs(to); } } ord.push_back(v); } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){ vector<int> lab(n); for(int i = 0;i < n - 1;i++){ g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } for(int i = 0;i < n;i++){ if((int)g[i].size() == 1){ dfs(i); break; } } for(int i = 0;i < (int)lab.size();i++){ lab[ord[i]] = i; } return lab; } int find_next_station(int s, int t, std::vector<int> c){ if(s < t)return s + 1; return s - 1; }
#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...