#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> label(int n,int k,vector<int> u,vector<int> v){
vector<int> l(n,-1),deg(n);
vector<vector<int>> AL;
AL.resize(n);
for(int i=0;i<n-1;++i){
++deg[u[i]];
++deg[v[i]];
AL[u[i]].pb(v[i]);
AL[v[i]].pb(u[i]);
}
for(int i=0;i<n;++i){
if(deg[i]==1){
int u=i;
l[u]=0;
while(true){
for(int v:AL[u]){
if(l[v]==-1){
l[v]=l[u]+1;
u=v;break;
}
}
if(AL[u].size()==1)break;
}
break;
}
}
return l;
}
int find_next_station(int s,int t,vector<int> c){
if(c.size()==1)return c[0];
if(s>t&&s>c[0])return c[0];
if(s>t&&s>c[1])return c[1];
if(s<t&&s<c[0])return c[0];
if(s<t&&s<c[1])return c[1];
return c[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
520 ms |
488 KB |
Output is correct |
2 |
Correct |
469 ms |
476 KB |
Output is correct |
3 |
Correct |
778 ms |
400 KB |
Output is correct |
4 |
Correct |
608 ms |
472 KB |
Output is correct |
5 |
Correct |
593 ms |
404 KB |
Output is correct |
6 |
Correct |
415 ms |
472 KB |
Output is correct |
7 |
Correct |
422 ms |
476 KB |
Output is correct |
8 |
Correct |
2 ms |
488 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
0 ms |
468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
288 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 |
554 ms |
484 KB |
Output is correct |
2 |
Correct |
564 ms |
472 KB |
Output is correct |
3 |
Correct |
930 ms |
528 KB |
Output is correct |
4 |
Correct |
699 ms |
488 KB |
Output is correct |
5 |
Correct |
454 ms |
492 KB |
Output is correct |
6 |
Correct |
343 ms |
480 KB |
Output is correct |
7 |
Correct |
439 ms |
492 KB |
Output is correct |
8 |
Correct |
2 ms |
508 KB |
Output is correct |
9 |
Correct |
3 ms |
468 KB |
Output is correct |
10 |
Correct |
0 ms |
420 KB |
Output is correct |
11 |
Incorrect |
1 ms |
284 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 |
809 ms |
400 KB |
Output is correct |
2 |
Correct |
703 ms |
404 KB |
Output is correct |
3 |
Correct |
726 ms |
400 KB |
Output is correct |
4 |
Correct |
3 ms |
404 KB |
Output is correct |
5 |
Correct |
3 ms |
480 KB |
Output is correct |
6 |
Correct |
2 ms |
468 KB |
Output is correct |
7 |
Incorrect |
0 ms |
268 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 |
525 ms |
532 KB |
Output is correct |
2 |
Correct |
550 ms |
480 KB |
Output is correct |
3 |
Correct |
898 ms |
400 KB |
Output is correct |
4 |
Correct |
655 ms |
400 KB |
Output is correct |
5 |
Correct |
512 ms |
484 KB |
Output is correct |
6 |
Correct |
470 ms |
464 KB |
Output is correct |
7 |
Correct |
530 ms |
480 KB |
Output is correct |
8 |
Correct |
2 ms |
476 KB |
Output is correct |
9 |
Correct |
3 ms |
468 KB |
Output is correct |
10 |
Correct |
0 ms |
468 KB |
Output is correct |
11 |
Incorrect |
4 ms |
348 KB |
Invalid labels (values out of range). scenario=0, k=1000000000, vertex=4, label=-1 |
12 |
Halted |
0 ms |
0 KB |
- |