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 rep(i,n) for(int i = 0; i<((int)n);i++)
int c;
vector<vector<int>>E;
vector<int>pre;
void dfs(int v, int p)
{
pre[v]=c++;
for(int w : E[v]) if(w!=p) dfs(w,v);
}
vector<int> label(int n, int k, std::vector<int> u, vector<int> v) {
E=vector<vector<int>>(n);
pre.assign(n,-1);
c=0;
rep(i,n-1) {E[u[i]].push_back(v[i]); E[v[i]].push_back(u[i]);}
dfs(0,-1);
return pre;
}
int find_next_station(int s, int t, vector<int> r) {
vector<int>b=r;
sort(b.begin(),b.end());
rep(i,b.size()-1) if(b[i+1]>t) return b[i];
return b[b.size()-1];
}
# | 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... |