#include"stations.h"
#include<iostream>
#include<vector>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
vi label(int n, int k, vi u, vi v) {
vvi L(n);
for (int i = 0; i < n-1; i++) {
L[u[i]].push_back(v[i]);
L[v[i]].push_back(u[i]);
}
int a = -1;
for (int i = 0; i < n; i++) {if (L[i].size() == 1) {a = i; break;}}
vi L2(n, -1);
int j = 1;
while (1) {
L2[a] = j;
j++;
if (L2[L[a][0]] == -1) {
a = L[a][0]; continue;
}
if (L[a].size() == 1) break;
a = L[a][1]; continue;
}
return L2;
}
int find_next_station(int s, int t, vi c) {
if (s > t) return s-1;
return s+1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
511 ms |
480 KB |
Output is correct |
2 |
Correct |
312 ms |
676 KB |
Output is correct |
3 |
Correct |
670 ms |
416 KB |
Output is correct |
4 |
Correct |
470 ms |
420 KB |
Output is correct |
5 |
Correct |
530 ms |
508 KB |
Output is correct |
6 |
Correct |
328 ms |
544 KB |
Output is correct |
7 |
Correct |
347 ms |
508 KB |
Output is correct |
8 |
Correct |
1 ms |
492 KB |
Output is correct |
9 |
Correct |
4 ms |
472 KB |
Output is correct |
10 |
Correct |
0 ms |
500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
292 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=4, label=-1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
418 ms |
500 KB |
Output is correct |
2 |
Correct |
455 ms |
508 KB |
Output is correct |
3 |
Correct |
679 ms |
500 KB |
Output is correct |
4 |
Correct |
533 ms |
508 KB |
Output is correct |
5 |
Correct |
515 ms |
416 KB |
Output is correct |
6 |
Correct |
318 ms |
508 KB |
Output is correct |
7 |
Correct |
307 ms |
524 KB |
Output is correct |
8 |
Correct |
2 ms |
508 KB |
Output is correct |
9 |
Correct |
2 ms |
492 KB |
Output is correct |
10 |
Correct |
0 ms |
492 KB |
Output is correct |
11 |
Incorrect |
0 ms |
296 KB |
Invalid labels (values out of range). scenario=1, k=1000000, vertex=3, label=-1 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
571 ms |
504 KB |
Output is correct |
2 |
Correct |
465 ms |
416 KB |
Output is correct |
3 |
Correct |
367 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
500 KB |
Output is correct |
5 |
Correct |
4 ms |
492 KB |
Output is correct |
6 |
Correct |
1 ms |
500 KB |
Output is correct |
7 |
Incorrect |
1 ms |
296 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=2, label=-1 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
439 ms |
516 KB |
Output is correct |
2 |
Correct |
282 ms |
580 KB |
Output is correct |
3 |
Correct |
787 ms |
508 KB |
Output is correct |
4 |
Correct |
481 ms |
420 KB |
Output is correct |
5 |
Correct |
430 ms |
416 KB |
Output is correct |
6 |
Correct |
402 ms |
544 KB |
Output is correct |
7 |
Correct |
431 ms |
548 KB |
Output is correct |
8 |
Correct |
2 ms |
488 KB |
Output is correct |
9 |
Correct |
3 ms |
492 KB |
Output is correct |
10 |
Correct |
0 ms |
492 KB |
Output is correct |
11 |
Incorrect |
4 ms |
328 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=4, label=-1 |
12 |
Halted |
0 ms |
0 KB |
- |