//#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
int t = 1;
vector<vector<int>>adj;
vector<int>labels;
void DFS(int node,int parent,int odd)
{
if (odd) labels[node] = t++;
for (int nenode : adj[node]) {
if (nenode != parent) {
DFS(nenode,node,1 - odd);
}
}
if (!odd) labels[node] = t++;
}
vector<int>label(int n, int k, vector<int> u, vector<int> v)
{
vector<vector<int>>adjc(n);
vector<int>labelsc(n);
adj = adjc;
labels = labelsc;
for (int i = 0; i < n - 1; i++)
{
adj[u[i] - 1].push_back(v[i] - 1);
adj[v[i] - 1].push_back(u[i] - 1);
}
t = 1;
return labels;
}
int find_next_station(int s,int t,vector<int> c)
{
int next = -1;
sort(c.begin(), c.end());
for (int st : c) {
if (st <= t) next = st;
}
if (next == -1) next = c[0];
return next;
}
| # | 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... |