Submission #824040

#TimeUsernameProblemLanguageResultExecution timeMemory
824040Abrar_Al_SamitStations (IOI20_stations)C++17
0 / 100
850 ms544 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; dfs(0); 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...