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 <bits/stdc++.h>
using namespace std;
vector <int> g[1005];
void dfs(int v, int p, int lab, vector <int> &labels) {
labels[v] = lab ++;
for (auto i: g[v]) {
if (i != p) dfs(i, v, lab, labels);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n), deg(n);
for (int i = 0; i < n - 1; i ++) {
deg[u[i]] ++;
deg[v[i]] ++;
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
for (int i = 0; i < n; i ++) {
if (deg[i] == 1) {
dfs(i, -1, 0, labels);
break;
}
}/*
for (auto i: labels) {
cout << i << " ";
} cout << endl;*/
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
if (c.size() == 1) return c[0];
if (s < t) return c[1];
return c[0];
}
# | 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... |