Submission #824083

#TimeUsernameProblemLanguageResultExecution timeMemory
824083Abrar_Al_SamitStations (IOI20_stations)C++17
0 / 100
638 ms548 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; const int nax = 1000; vector<int>g[nax]; vector<int> labels; int _tm; void dfs(int v, int p = -1) { labels[v] = _tm++; for(int u : g[v]) if(u-p) { dfs(u, v); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { labels.resize(n); for(int i=0; i<n; ++i) g[i].clear(); for(int i=0; i<n-1; ++i) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } _tm = 0; int r = 0; for(int i=0; i<n; ++i) if(g[i].size()>2) { r = i; break; } dfs(r); return labels; } int find_next_station(int s, int t, vector<int> c) { if(t < s) return c[0]; int m = c.size(); for(int i=0; i<m-1; ++i) { if(t>=c[i] && t<c[i+1]) return c[i]; } return c[m-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...