# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
308643 | pit4h | Stations (IOI20_stations) | C++14 | 1016 ms | 1280 KiB |
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 st first
#define nd second
using namespace std;
void dfs(int x, int p, vector<int>& h, vector<vector<int>>& g, vector<int>& path) {
h[x] = h[p] + 1;
path.push_back(x);
for(int i: g[x]) {
if(i != p) {
dfs(i, x, h, g, path);
}
}
path.push_back(x);
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
vector<vector<int>> g(n);
for(int i=0; i<n-1; ++i) {
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
for(int i=0; i<n; ++i) {
sort(g[i].begin(), g[i].end());
}
vector<int> h(n), path;
dfs(0, 0, h, g, path);
vector<vector<int>> pos(n);
for(int i=0; i<(int)path.size(); ++i) {
# | 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... |