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>
using namespace std;
const int N = 2e5 + 12;
vector<int> g[N],ord;
bool vis[N];
void dfs(int v){
vis[v] = 1;
for(int to:g[v]){
if(!vis[to]){
dfs(to);
}
}
ord.push_back(v);
}
vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){
vector<int> lab(n);
for(int i = 0;i < n;i++){
lab[i] = i;
}
return lab;
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++){
if((int)g[i].size() == 1){
dfs(i);
break;
}
}
for(int i = 0;i < (int)lab.size();i++){
lab[ord[i]] = i;
}
return lab;
}
int find_next_station(int s, int t, std::vector<int> c){
if(s < t)return s + 1;
return s - 1;
}
# | 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... |