#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
vector < int > adj[N];
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
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];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
620 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
620 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
652 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |