#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> label(int n,int k,vector<int> u,vector<int> v){
vector<int> l(n);
for(int i=0;i<n;++i)l[i]=i;
return l;
}
int pre[1005],pst[1005],cnt;
void dfs(int u){
if(u>1000)return;
pre[u-1]=cnt++;
dfs(2*u);dfs(2*u+1);
pst[u-1]=cnt-1;
}
int find_next_station(int s,int t,vector<int> c){
++s;++t;
if(cnt==0)dfs(1);
if(2*s>1000)return c[0];
if(pre[2*s]<=pre[t]&&pst[t]<=pre[2*s])return 2*s-1;
if(pre[2*s+1]<=pre[t]&&pst[t]<=pre[2*s+1])return 2*s;
return s/2-1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
634 ms |
548 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
728 ms |
476 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
671 ms |
400 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1212 ms |
492 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
730 ms |
400 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |