#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
vector < int > lb, adj[N];
int num;
void dfs( int v, int pr ) {
lb[v] = num++;
// cout << "v -> " << v << ' ' << num - 1 << endl;
for ( auto u: adj[v] ) {
if ( u != pr ) {
dfs(u, v);
}
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for ( int i = 0; i < n - 1; i++ ) {
int x = u[i], y = v[i];
adj[x].push_back(y);
adj[y].push_back(x);
}
lb.clear();
lb.resize(n);
dfs(0, -1);
return lb;
}
int find_next_station(int s, int t, std::vector<int> c) {
int pr = c[0];
for ( auto x: c ) {
if ( x == pr ) {
continue;
}
if ( x > t ) {
break;
}
pr = x;
}
return pr;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1475 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3079 ms |
492 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1643 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
888 ms |
952 KB |
Output is correct |
2 |
Runtime error |
1324 ms |
2097156 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2850 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |