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 <vector>
#include <algorithm>
using namespace std;
vector<int> e[1000], lab;
int co;
void df(int no, int pa) {
lab[no] = co++;
for (int ed : e[no]) {
if (ed != pa) df(ed, no);
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
co = 0;
lab.resize(n);
for (int i = 0; i < n; i++) e[i].clear();
for (int i = 0; i < n - 1; i++) {
e[u[i]].push_back(v[i]);
e[v[i]].push_back(u[i]);
}
df(0, 0);
return lab;
}
int find_next_station(int s, int t, std::vector<int> c) {
if (t < s) return c[0];
return *(upper_bound(c.begin(), c.end(), t) - 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... |