This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
vector<int>label(int n,int k,vector<int>u,vector<int>v){
vector<int>l(n);
vector<int>adj[n];
for(int i=0;i<n-1;i++){
adj[u[i]].pb(v[i]);
adj[v[i]].pb(u[i]);
}
vector<int>ord;
function <void(int,int)> dfs=[&](int x,int p){
ord.pb(x);
for(auto y:adj[x]){
if(y!=p){
dfs(y,x);
}
}
};
for(int i=0;i<n;i++){
if(adj[i].size()==1){
dfs(i,-1);
break;
}
}
for(int i=0;i<n;i++){
l[ord[i]]=i;
}
return l;
}
int find_next_station(int s,int t,vector<int>c){
if(t<s) return c[0];
return c.back();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |