Submission #306834

#TimeUsernameProblemLanguageResultExecution timeMemory
306834baluteshihStations (IOI20_stations)C++14
5 / 100
1019 ms1140 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define X first #define Y second #define ALL(v) v.begin(),v.end() #define pb push_back #define SZ(a) ((int)a.size()) const int C=1000; vector<int> G[1005],idx; int dft; void dfs(int u,int f) { idx[u]=++dft; for(int i:G[u]) if(i!=f) dfs(i,u); } vector<int> label(int n, int k, vector<int> u, vector<int> v) { idx.resize(n),dft=-1; for(int i=0;i<n;++i) G[i].clear(); for(int i=0;i+1<n;++i) G[u[i]].pb(v[i]),G[v[i]].pb(u[i]); for(int i=0;i<n;++i) if(SZ(G[i])==1) { dfs(i,i); break; } return idx; } int find_next_station(int s, int t, vector<int> c) { if(s>t) return *min_element(ALL(c)); else return *max_element(ALL(c)); }
#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...