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>
using namespace std;
const int nax = 1000;
vector<int>g[nax];
vector<int> labels;
int _tm;
void dfs(int v, int p = -1) {
labels[v] = _tm++;
for(int u : g[v]) if(u-p) {
dfs(u, v);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
labels.resize(n);
for(int i=0; i<n; ++i) g[i].clear();
for(int i=0; i<n-1; ++i) {
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
_tm = 0;
dfs(0);
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
if(t < s) return c[0];
int m = c.size();
for(int i=1; i<m-1; ++i) {
if(t>=c[i] && t<c[i+1]) return c[i];
}
return c[m-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... |