#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool visited[1001];
vector<int> a, adj[1001];
int curr;
void dfs(int x=0) {
visited[x]=1;
a[x]=curr++;
for(auto i: adj[x]) if(!visited[i]) dfs(i);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
curr=0;
a.resize(n);
memset(visited, 0, sizeof(visited));
for(int i=0; i<1001; i++) adj[i].clear();
for(int i=0; i<n-1; i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
dfs();
for(auto i: a) cout << i << " ";
return a;
}
int find_next_station(int s, int t, std::vector<int> c) {
return c[lower_bound(c.begin(), c.end(), t)-c.begin()];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
320 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
320 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
208 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
304 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |