# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
387825 | WLZ | Stations (IOI20_stations) | C++14 | 897 ms | 852 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>
using namespace std;
int dfs_cnt = 0;
vector< vector<int> > g;
vector<int> d, dfs_in, dfs_out;
void dfs(int u, int p) {
dfs_in[u] = dfs_cnt++;
for (auto& v : g[u]) {
if (v != p) {
d[v] = d[u] + 1;
dfs(v, u);
}
}
dfs_out[u] = dfs_cnt++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
g.assign(n, {});
d.assign(n, 0);
for (int i = 0; i < n - 1; i++) {
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
dfs_in.assign(n, 0); dfs_out.assign(n, 0);
dfs(0, -1);
set<int> st;
for (int i = 0; i < n; 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... |