#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
const int N=1005;
int tme;
vector<int> lab;
vector<int> nei[N];
map<int,int> mp;
void dfs(int x,int p,int lv){
if(lv) lab[x-1]=tme++;
for(int i=0;i<int(nei[x].size());i++){
int to=nei[x][i];
if(to!=p) dfs(to,x,lv^1);
}
if(!lv) lab[x-1]=tme++;
}
vector<int> label(int n,int k,vector<int> u,vector<int> v){
lab.clear();
lab.resize(n);
tme=0;
for(int i=1;i<=n;i++) nei[i].clear();
for(int i=0;i<n-1;i++){
u[i]++;v[i]++;
// printf("%d %d\n",u[i],v[i]);
nei[u[i]].push_back(v[i]);
nei[v[i]].push_back(u[i]);
}
dfs(1,-1,0);
return lab;
}
int find_next_station(int s,int t,vector<int> c){
sort(c.begin(),c.end());
if(s<c[0]){
if(t>s) return *lower_bound(c.begin(),c.end(),t);
else return c[int(c.size())-1];
}else{
if(t<s) return *(lower_bound(c.begin(),c.end(),t+1)-1);
else return c[0];
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
551 ms |
1048 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
472 ms |
816 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
539 ms |
1032 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
863 ms |
1032 KB |
Output is correct |
2 |
Correct |
768 ms |
1004 KB |
Output is correct |
3 |
Incorrect |
713 ms |
876 KB |
Wrong query response. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
520 ms |
1024 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |