This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///~~~LOTA~~~///
//#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 1000
int m;
int e[N];
vector<int> l;
vector<int> a[N];
void dfs(int v,int u){
l[v]=m;
m++;
for(auto& i:a[v])
if(i!=u) dfs(i,v);
}
vector<int> label(int n,int k,vector<int> u,vector<int> v){
l.clear();
for(int i=m=0;i<n;i++){
a[i].clear();
l.append(0);
e[i]=0;
}
for(int i=0;i<n-1;i++){
a[v[i]].append(u[i]);
a[u[i]].append(v[i]);
e[v[i]]++;
e[u[i]]++;
}
for(int i=0;i<n;i++){
if(e[i]>1) continue;
dfs(i,-1);
break;
}
return(l);
}
int find_next_station(int s,int t,vector<int> c){
return s-(s>t)+(t>s);
}
# | 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... |