#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> edges[1005];
int dp[1005];
int mm=0, mx=-1;
vector<bool> used;
void dfs(int u, int d=0){
dp[u] = d;
used[u] = true;
if(mx < d)mx=d,mm=u;
for(auto v:edges[u]){
if(used[v])continue;
dfs(v,d+1);
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
for(int i=0;i<n-1;i++){
edges[u[i]].push_back(v[i]);
edges[v[i]].push_back(u[i]);
}
used.assign(n,0);
dfs(mm);
used.assign(n,0);
dfs(mm);
vector<int> ans(n);
for(int i=0;i<n;i++)ans[i] = dp[i];
return ans;
}
/*
1
5 10
0 1
1 2
2 3
3 4
3
1 3 121
1 4 121
0 1 122
*/
int find_next_station(int s, int t, vector<int> c) {
if(s <= t)return s+1;
else return s-1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
484 KB |
Invalid labels (duplicates values). scenario=2, label=3 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
512 KB |
Invalid labels (duplicates values). scenario=0, label=9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
492 KB |
Invalid labels (duplicates values). scenario=1, label=635 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
902 ms |
864 KB |
Output is correct |
2 |
Incorrect |
671 ms |
948 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
512 KB |
Invalid labels (duplicates values). scenario=1, label=715 |
2 |
Halted |
0 ms |
0 KB |
- |