Submission #1048910

#TimeUsernameProblemLanguageResultExecution timeMemory
1048910idasStations (IOI20_stations)C++17
0 / 100
3028 ms2097152 KiB
#include "stations.h" #include "bits/stdc++.h" #define FOR(i, begin, end) for(int i=(begin); i<(end); i++) #define sz(x) ((int)((x).size())) #define pb push_back using namespace std; typedef vector<int> vi; const int N=1e3+10; int in[N], id; vi ad[N]; void dfs(int u, int pst=-1) { in[u]=id++; for(auto it : ad[u]) { if(it==pst) continue; dfs(it, u); } } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { FOR(i, 0, n-1) ad[u[i]].pb(v[i]), ad[v[i]].pb(u[i]); id=0; dfs(0); vi labels(n); FOR(i, 0, n) labels[i]=in[i]; return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(t<s) return c[0]; int j=sz(c)-1; FOR(i, 1, sz(c)) { if(c[i]>t) { j=i-1; break; } } return c[j]; }
#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...