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 "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 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... |