#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
vector < int > adj[n + 7];
for ( int i = 0; i < n; i++ ) {
int x = u[i], y = v[i];
adj[x].push_back(y);
adj[y].push_back(x);
}
vector < int > used(n + 1);
int rt = -1;
for ( int i = 0; i < n; i++ ) {
if ( adj[i].size() == 1 && !used[i] ) {
rt = i;
break;
}
}
int x = rt, num = 0;
while ( 1 ) {
labels[x] = num++;
used[x] = 1;
int ok = 1;
for ( auto y: adj[x] ) {
if ( !used[y] ) {
x = y;
ok = 0;
break;
}
}
if ( ok ) {
break;
}
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if ( c.size() == 1 ) {
return c[0];
}
if ( s < t ) {
return c[1];
}
return c[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
768 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
840 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
620 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
882 ms |
868 KB |
Output is correct |
2 |
Correct |
871 ms |
864 KB |
Output is correct |
3 |
Correct |
695 ms |
868 KB |
Output is correct |
4 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
620 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |