Submission #601926

#TimeUsernameProblemLanguageResultExecution timeMemory
601926definitelynotmeeStations (IOI20_stations)C++17
0 / 100
865 ms632 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(x) x.begin(), x.end() using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename T> using matrix = vector<vector<T>>; std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { matrix<int> g(n); for(int i = 0; i < n-1; i++){ g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } int timer = -1; vector<int> labels(n); auto dfs =[&](int id, int last, auto dfs)->void{ labels[id] = ++timer; for(int i : g[id]){ if(i!=last) dfs(i,id,dfs); } }; dfs(0,0,dfs); return labels; } int find_next_station(int s, int t, std::vector<int> c) { int id = upper_bound(all(c),t)-c.begin(); if(id > 0) id--; return c[id]; }
#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...