# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
321669 | 2020-11-13T03:05:53 Z | Gilgamesh | Stations (IOI20_stations) | C++17 | 0 ms | 0 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using ull = unsigned ll; #define pb push_back #define mp make_pair #define eb emplace_back #define all(x) (x).begin(),(x).end() #define x first #define y second #define PI 3.14159265 const int mxN = 1'001; vector<int> adj[mxN]; int timer; void dfs(int v, int p, vector<int>& labels){ labels[timer++] = v; for(int i : adj[v]) { if(i == p) continue; dfs(i, v, labels); } } vector<int> label(int n, int k, vector<int> u, svector<int> v) { vector<int> labels(n); for(int i = 0; i < n - 1; ++i){ adj[u[i]].eb(adj[v[i]]); adj[v[i]].eb(adj[u[i]]); } timer = 0; dfs(0, -1, labels); return labels; } int find_next_station(int s, int t, vector<int> c) { sort(all(c)); if(t < s) { return c[0]; } else { int ans = 0; for(int i : c){ if(t < i) break; ans = i; } return ans; } } //int main(){}