# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
524949 | Turkhuu | 기지국 (IOI20_stations) | C++17 | 997 ms | 736 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;
vector<int> label(int n, int K, vector<int> U, vector<int> V){
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]);
}
vector<int> a(n);
int k = 1;
function<void(int, int)> dfs = [&](int u, int anc){
for(int v : g[u]){
if(v == anc){
continue;
}
a[v] = k++;
for(int w : g[v]){
if(w != u){
dfs(w, v);
}
}
}
a[u] = k++;
};
a[0] = 0;
for(int v : g[0]){
dfs(v, 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... |