#include "stations.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
vector<vector<int>> v;
vector<int> order;
void dfs(int nd, int ss){
order.pb(nd);
for(int x: v[nd]) if(x != ss) dfs(x, nd);
}
vector<int> label(int n, int k, vector<int> aa, vector<int> bb){
v.assign(n, {});
order.clear();
for(int i = 0; i < n-1; i++){
v[aa[i]].pb(bb[i]);
v[bb[i]].pb(aa[i]);
}
for(int i = 0; i < n; i++){
if(v[i].size() == 1){
dfs(i, -1);
break;
}
}
vector<int> lb(n);
for(int i = 0; i < n; i++) lb[order[i]] = i;
return lb;
}
int find_next_station(int s, int t, vector<int> c){
if(s < t) return s+1;
return s-1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
523 ms |
1192 KB |
Output is correct |
2 |
Correct |
468 ms |
976 KB |
Output is correct |
3 |
Correct |
1059 ms |
896 KB |
Output is correct |
4 |
Correct |
671 ms |
868 KB |
Output is correct |
5 |
Correct |
582 ms |
868 KB |
Output is correct |
6 |
Correct |
506 ms |
1140 KB |
Output is correct |
7 |
Correct |
517 ms |
884 KB |
Output is correct |
8 |
Correct |
3 ms |
736 KB |
Output is correct |
9 |
Correct |
4 ms |
876 KB |
Output is correct |
10 |
Correct |
2 ms |
736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
554 ms |
884 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
625 ms |
884 KB |
Output is correct |
2 |
Correct |
477 ms |
884 KB |
Output is correct |
3 |
Correct |
906 ms |
868 KB |
Output is correct |
4 |
Correct |
787 ms |
900 KB |
Output is correct |
5 |
Correct |
637 ms |
892 KB |
Output is correct |
6 |
Correct |
461 ms |
988 KB |
Output is correct |
7 |
Correct |
516 ms |
1044 KB |
Output is correct |
8 |
Correct |
3 ms |
756 KB |
Output is correct |
9 |
Correct |
5 ms |
736 KB |
Output is correct |
10 |
Correct |
2 ms |
736 KB |
Output is correct |
11 |
Incorrect |
704 ms |
736 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
852 ms |
868 KB |
Output is correct |
2 |
Correct |
714 ms |
756 KB |
Output is correct |
3 |
Correct |
677 ms |
756 KB |
Output is correct |
4 |
Correct |
3 ms |
868 KB |
Output is correct |
5 |
Correct |
5 ms |
736 KB |
Output is correct |
6 |
Correct |
2 ms |
876 KB |
Output is correct |
7 |
Incorrect |
621 ms |
868 KB |
Wrong query response. |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
675 ms |
1132 KB |
Output is correct |
2 |
Correct |
582 ms |
1104 KB |
Output is correct |
3 |
Correct |
1000 ms |
736 KB |
Output is correct |
4 |
Correct |
681 ms |
1004 KB |
Output is correct |
5 |
Correct |
651 ms |
884 KB |
Output is correct |
6 |
Correct |
449 ms |
996 KB |
Output is correct |
7 |
Correct |
547 ms |
884 KB |
Output is correct |
8 |
Correct |
3 ms |
916 KB |
Output is correct |
9 |
Correct |
5 ms |
756 KB |
Output is correct |
10 |
Correct |
2 ms |
736 KB |
Output is correct |
11 |
Incorrect |
517 ms |
864 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |