// #include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define endl "\n"
#define pb push_back
const int N = 1e3 + 5;
int a[N] , now;
vector<int> lis[N];
void dfs(int u , int par , int di){
    if ((di % 2) == 0){
        a[u] = now;
        now++;
    }
    for (int v : lis[u]){
        if (v != par){
            dfs(v , u , di+1);
        }
    }
    if ((di % 2) == 1){
        a[u] = now;
        now++;
    }
}
vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vector<int> labels(n);
    for (int i = 0 ; i < n ; i++){
        lis[i].clear();
    }
    now = 0;
    for (int i = 0 ; i < n - 1 ; i++){
        lis[u[i]].pb(v[i]);
        lis[v[i]].pb(u[i]);
    }
    dfs(0 , 0 , 0);
	for (int i = 0; i < n; i++) {
		labels[i] = a[i];
	}
	return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
    int n = c.size();
	if (c.back() < s){
        if (s < t){
            return c[0];
        }else{
            int pr = 0;
            for (int i = 1 ; i < n ; i++){
                if (c[i] > t){
                    break;
                }else{
                    pr++;
                }
            }
            return c[pr];
        }
    }else{
        if (t < s){
            return c.back();
        }
        int pr = n - 1;
        for (int i = n - 2 ; i >= 0 ; i--){
            if (c[i] < t){
                break;
            }else{
                pr--;
            }
        }
        return c[pr];
    }
}
| # | 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... |