#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=l[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 |
2 ms |
452 KB |
Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1991 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
312 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 |
3 ms |
456 KB |
Invalid labels (duplicates values). scenario=1, label=1842 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1005 ms |
472 KB |
Output is correct |
2 |
Correct |
666 ms |
528 KB |
Output is correct |
3 |
Incorrect |
577 ms |
516 KB |
Wrong query response. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
480 KB |
Invalid labels (duplicates values). scenario=1, label=922 |
2 |
Halted |
0 ms |
0 KB |
- |