#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(). x.rend()
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<double> cd;
void build(int ver, int prev, int cnt, vector<int>& arr, vector<vector<int>>& adj){
arr[ver]=cnt;
for(auto u : adj[ver]){
if(u==prev) continue;
build(u, ver, cnt+1, arr, adj);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<vector<int>> adj(n);
vector<int> labels(n);
for(int i=0;i<n-1;i++){
adj[u[i]].pb(v[i]);
adj[v[i]].pb(u[i]);
}
for(int i=0;i<n;i++){
if((int)adj[i].size()==1){
build(i, -1, 0, labels, adj);
break;
}
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
if(t>s) return s+1;
return s-1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
340 ms |
684 KB |
Output is correct |
2 |
Correct |
281 ms |
684 KB |
Output is correct |
3 |
Correct |
660 ms |
684 KB |
Output is correct |
4 |
Correct |
470 ms |
684 KB |
Output is correct |
5 |
Correct |
464 ms |
684 KB |
Output is correct |
6 |
Correct |
292 ms |
684 KB |
Output is correct |
7 |
Correct |
310 ms |
684 KB |
Output is correct |
8 |
Correct |
2 ms |
764 KB |
Output is correct |
9 |
Correct |
1 ms |
776 KB |
Output is correct |
10 |
Correct |
0 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
344 KB |
Invalid labels (duplicates values). scenario=0, label=10 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
321 ms |
684 KB |
Output is correct |
2 |
Correct |
328 ms |
928 KB |
Output is correct |
3 |
Correct |
626 ms |
940 KB |
Output is correct |
4 |
Correct |
447 ms |
684 KB |
Output is correct |
5 |
Correct |
404 ms |
684 KB |
Output is correct |
6 |
Correct |
309 ms |
684 KB |
Output is correct |
7 |
Correct |
294 ms |
684 KB |
Output is correct |
8 |
Correct |
1 ms |
768 KB |
Output is correct |
9 |
Correct |
1 ms |
768 KB |
Output is correct |
10 |
Correct |
0 ms |
776 KB |
Output is correct |
11 |
Incorrect |
0 ms |
344 KB |
Invalid labels (duplicates values). scenario=1, label=2 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
603 ms |
684 KB |
Output is correct |
2 |
Correct |
428 ms |
684 KB |
Output is correct |
3 |
Correct |
353 ms |
684 KB |
Output is correct |
4 |
Correct |
1 ms |
776 KB |
Output is correct |
5 |
Correct |
2 ms |
768 KB |
Output is correct |
6 |
Correct |
0 ms |
768 KB |
Output is correct |
7 |
Incorrect |
1 ms |
344 KB |
Invalid labels (duplicates values). scenario=0, label=2 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
376 ms |
684 KB |
Output is correct |
2 |
Correct |
306 ms |
684 KB |
Output is correct |
3 |
Correct |
621 ms |
712 KB |
Output is correct |
4 |
Correct |
429 ms |
684 KB |
Output is correct |
5 |
Correct |
390 ms |
684 KB |
Output is correct |
6 |
Correct |
330 ms |
684 KB |
Output is correct |
7 |
Correct |
311 ms |
684 KB |
Output is correct |
8 |
Correct |
1 ms |
776 KB |
Output is correct |
9 |
Correct |
2 ms |
768 KB |
Output is correct |
10 |
Correct |
0 ms |
772 KB |
Output is correct |
11 |
Incorrect |
2 ms |
344 KB |
Invalid labels (duplicates values). scenario=0, label=10 |
12 |
Halted |
0 ms |
0 KB |
- |