#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
const int N = 1005;
vector<int> adj[N];
int dtime , a[N];
void dfs(int u , int p = -1){
a[u] =1000 * dtime; dtime++;
for(int v : adj[u])if(v ^ p)dfs(v ,u);
a[u] += dtime;
}
vector<int> label(int n , int k ,vector<int> u , vector<int> v){
for(int i = 0; i < n; ++i) adj[i].clear();
for(int i = 0; i < n; ++i) adj[u[i]].emplace_back(v[i]) , adj[v[i]].emplace_back(u[i]);
vector<int> R(n);
dfs(0);
for(int i=0; i < n; ++i)R.emplace_back(a[i]);
return R;
}
int find_next_station(int s , int t , vector<int> c){
reverse(c.begin() , c.end());
for(int x : c){
int in = x / 1000 , out = x % 1000;
if(in <= t && t <= out) return x;
}
return c.back();
}
/*
int main (){
cin >> n;
for(int i =1; i < n; ++i){
int u , v; cin >> u>> v;
adj[u].emplace_back(v); adj[v].emplace_back(u);
}
vector<int> k = label(n , 1 , {3} , {3});
cout << find_next_station(1 , 3 , {3 , 2 ,0}) << endl;
}
*/
//int main (){}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Invalid length of array as the response of 'label'. scenario=0, n=10, len=20 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Invalid length of array as the response of 'label'. scenario=0, n=996, len=1992 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Invalid length of array as the response of 'label'. scenario=0, n=2, len=4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
492 KB |
Invalid length of array as the response of 'label'. scenario=0, n=2, len=4 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Invalid length of array as the response of 'label'. scenario=0, n=3, len=6 |
2 |
Halted |
0 ms |
0 KB |
- |