Submission #719294

#TimeUsernameProblemLanguageResultExecution timeMemory
719294mseebacherStations (IOI20_stations)C++17
0 / 100
3144 ms2097152 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define MAXI (int)1e3+10 vector<int> ad[MAXI]; vector<int> labels; void dfs(int x,int e,int tiefe){ labels[x] = tiefe; for(auto s: ad[x]){ if(s == e) continue; dfs(s,x,tiefe++); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { labels.assign(n,0); for(int i = 0;i<n-1;i++){ ad[u[i]].push_back(v[i]); ad[v[i]].push_back(u[i]); } int start = -1; for(int i = 0;i<n;i++){ if(ad[i].size() == 1) start = i; } dfs(start,-1,0); return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(s > t) return c[0]; return c[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...