#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;
inline 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 |
604 ms |
980 KB |
Output is correct |
2 |
Correct |
483 ms |
976 KB |
Output is correct |
3 |
Correct |
927 ms |
736 KB |
Output is correct |
4 |
Correct |
699 ms |
868 KB |
Output is correct |
5 |
Correct |
699 ms |
756 KB |
Output is correct |
6 |
Correct |
418 ms |
884 KB |
Output is correct |
7 |
Correct |
444 ms |
1024 KB |
Output is correct |
8 |
Correct |
3 ms |
736 KB |
Output is correct |
9 |
Correct |
5 ms |
776 KB |
Output is correct |
10 |
Correct |
2 ms |
736 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
534 ms |
940 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
694 ms |
896 KB |
Output is correct |
2 |
Correct |
482 ms |
884 KB |
Output is correct |
3 |
Correct |
1029 ms |
756 KB |
Output is correct |
4 |
Correct |
811 ms |
736 KB |
Output is correct |
5 |
Correct |
556 ms |
884 KB |
Output is correct |
6 |
Correct |
457 ms |
884 KB |
Output is correct |
7 |
Correct |
534 ms |
884 KB |
Output is correct |
8 |
Correct |
3 ms |
756 KB |
Output is correct |
9 |
Correct |
4 ms |
756 KB |
Output is correct |
10 |
Correct |
2 ms |
868 KB |
Output is correct |
11 |
Incorrect |
765 ms |
756 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
964 ms |
756 KB |
Output is correct |
2 |
Correct |
866 ms |
868 KB |
Output is correct |
3 |
Correct |
621 ms |
1008 KB |
Output is correct |
4 |
Correct |
3 ms |
736 KB |
Output is correct |
5 |
Correct |
7 ms |
736 KB |
Output is correct |
6 |
Correct |
2 ms |
868 KB |
Output is correct |
7 |
Incorrect |
796 ms |
868 KB |
Wrong query response. |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
609 ms |
1212 KB |
Output is correct |
2 |
Correct |
530 ms |
864 KB |
Output is correct |
3 |
Correct |
1023 ms |
756 KB |
Output is correct |
4 |
Correct |
872 ms |
868 KB |
Output is correct |
5 |
Correct |
705 ms |
756 KB |
Output is correct |
6 |
Correct |
471 ms |
892 KB |
Output is correct |
7 |
Correct |
489 ms |
884 KB |
Output is correct |
8 |
Correct |
3 ms |
908 KB |
Output is correct |
9 |
Correct |
3 ms |
736 KB |
Output is correct |
10 |
Correct |
2 ms |
1012 KB |
Output is correct |
11 |
Incorrect |
596 ms |
884 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |