# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
609774 | daria | 기지국 (IOI20_stations) | C++14 | 0 ms | 0 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"bits/stdc++.h"
#include "stations.h"
#include <vector>
using namespace std;
const int N = 1000;
int T = 0;
vector<int> adj[N], lb(N, -1);
void dfs(int s){
if(lb[s]!=-1) return;
lb[s] = T*N; T++;
for(auto u : adj[s]) dfs(u);
lb[s] += T;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
for(int i=0; i<n-1; ++i){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
dfs(0);
lb.resize(n);
return lb;
}