#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> g[1005];int l[1005];
int d(int n,int a,int s,bool p){
int c=1;int f=s;
for(auto i:g[n])if(i!=a){c+=d(i,n,f,!p);f=i;}
if(p)l[n]=s+c;
else l[n]=s-c;
return c;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for(int i=0;i<n-1;i++){g[u[i]].push_back(v[i]);g[v[i]].push_back(u[i]);}
k=d(0,n,n,0);vector<int> r;
for(int i=0;i<n;i++){r.push_back(l[i]);g[i].clear();}
return r;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(s<c[0]){
if(t<s||t>=c.back())return c.back();
for(auto i:c)if(t<=i)return i;
}
else{
reverse(c.begin(),c.end());
if(t>s||t<=c.back())return c.back();
for(auto i:c)if(t>=i)return i;
}
exit(1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
456 KB |
Invalid labels (duplicates values). scenario=0, label=11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
304 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1507 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
456 KB |
Invalid labels (duplicates values). scenario=1, label=177 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1150 ms |
496 KB |
Output is correct |
2 |
Correct |
773 ms |
512 KB |
Output is correct |
3 |
Incorrect |
1 ms |
200 KB |
Invalid labels (duplicates values). scenario=5, label=0 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
424 KB |
Invalid labels (duplicates values). scenario=1, label=972 |
2 |
Halted |
0 ms |
0 KB |
- |