#include <bits/stdc++.h>
#include "stations.h"
using namespace std;
typedef long long ll;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<ll> degree(n);
vector<vector<int>> adj(n);
for (ll i = 0; i < n-1; i++) {
degree[u[i]]++;
degree[v[i]]++;
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
ll one = 0;
for (ll i = 0; i < n; i++) {
if (degree[i] == 1) {
one = i;
break;
}
}
vector<int> res(n);
ll prev = -1;
for (ll i = 0; i < n; i++) {
res[one] = i;
for (auto &e : adj[one]) {
if (e != prev) {
prev = one;
one = e;
break;
}
}
}
return res;
}
int find_next_station(int s, int t, vector<int> c) {
if (t > s) return s + 1;
else return s - 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
415 ms |
864 KB |
Output is correct |
2 |
Correct |
324 ms |
860 KB |
Output is correct |
3 |
Correct |
669 ms |
684 KB |
Output is correct |
4 |
Correct |
485 ms |
684 KB |
Output is correct |
5 |
Correct |
453 ms |
700 KB |
Output is correct |
6 |
Correct |
337 ms |
864 KB |
Output is correct |
7 |
Correct |
314 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
1020 KB |
Output is correct |
9 |
Correct |
3 ms |
768 KB |
Output is correct |
10 |
Correct |
0 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
520 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
385 ms |
860 KB |
Output is correct |
2 |
Correct |
334 ms |
952 KB |
Output is correct |
3 |
Correct |
684 ms |
856 KB |
Output is correct |
4 |
Correct |
508 ms |
684 KB |
Output is correct |
5 |
Correct |
435 ms |
940 KB |
Output is correct |
6 |
Correct |
322 ms |
856 KB |
Output is correct |
7 |
Correct |
333 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
768 KB |
Output is correct |
9 |
Correct |
1 ms |
764 KB |
Output is correct |
10 |
Correct |
0 ms |
772 KB |
Output is correct |
11 |
Incorrect |
1 ms |
516 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
586 ms |
684 KB |
Output is correct |
2 |
Correct |
450 ms |
860 KB |
Output is correct |
3 |
Correct |
344 ms |
940 KB |
Output is correct |
4 |
Correct |
1 ms |
772 KB |
Output is correct |
5 |
Correct |
3 ms |
764 KB |
Output is correct |
6 |
Correct |
1 ms |
936 KB |
Output is correct |
7 |
Incorrect |
1 ms |
344 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
364 ms |
1044 KB |
Output is correct |
2 |
Correct |
297 ms |
860 KB |
Output is correct |
3 |
Correct |
626 ms |
852 KB |
Output is correct |
4 |
Correct |
446 ms |
688 KB |
Output is correct |
5 |
Correct |
395 ms |
684 KB |
Output is correct |
6 |
Correct |
325 ms |
860 KB |
Output is correct |
7 |
Correct |
342 ms |
684 KB |
Output is correct |
8 |
Correct |
1 ms |
768 KB |
Output is correct |
9 |
Correct |
3 ms |
768 KB |
Output is correct |
10 |
Correct |
0 ms |
768 KB |
Output is correct |
11 |
Incorrect |
4 ms |
516 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
12 |
Halted |
0 ms |
0 KB |
- |