Submission #824055

#TimeUsernameProblemLanguageResultExecution timeMemory
824055Abrar_Al_SamitStations (IOI20_stations)C++17
0 / 100
628 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); } labels[v] |= _tm<<10; } 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) { int m = c.size(); vector<pair<int,int>>rng(m); for(int i=0; i<m; ++i) { rng[i].first = (((1<<10)-1)&c[i]); rng[i].second = (c[i] - rng[i].first) >> 10; } sort(rng.begin(), rng.end()); for(int i=1; i<m; ++i) { if(t >= rng[i].first && t <= rng[i].second) { return rng[i].first + (rng[i].second << 10); } } return rng[0].first + (rng[0].second << 10); }
#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...