# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
398255 | Everule | Stations (IOI20_stations) | C++17 | 1142 ms | 984 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;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
vector<vector<int>> adj(n);
for(int i=0;i<n-1;i++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
vector<int> tin(n), tout(n), dep(n);
int t = 0;
function<void(int,int)> dfs = [&](int u,int p){
tin[u] = t++;
for(auto &v : adj[u]){
if(v == p) continue;
dep[v] = dep[u] + 1;
dfs(v, u);
}
tout[u] = t++;
};
dfs(0, 0);
for(int i=0;i<n;i++){
if(dep[i] % 2 == 0){
labels[i] = tin[i];
}
else{
labels[i] = tout[i];
}
}
Compilation message (stderr)
# | 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... |