#ifndef ARTHUR_LOCAL
#include "stations.h"
#endif
#ifdef ARTHUR_LOCAL
#include <bits/stdc++.h>
#endif
using namespace std;
using ll = long long;
vector<int> adj[1001];
bool vis[1001];
int curv;
int labellist[1001];
void dfs(int v)
{
vis[v]=1;
labellist[v]=curv++;
for(auto u:adj[v])
{
if(!vis[u]) dfs(u);
}
}
vector<int> label(int n, int k, vector<int> U, vector<int> V)
{
vector<int> ans;
for(int i=0; i<n; i++) ans.push_back(i);
return ans;
}
int find_next_station(int s, int t, vector<int> C)
{
vector<int> level(1001);
level[0]=1;
for(int i=0; i<=1000; i++)
{
if(2*i + 1 <= 1000) level[2*i + 1] = 1 + level[i];
if(2*i + 2 <= 1000) level[2*i + 2] = 1 + level[i];
// if(i<100) cout << i << " " << level[i] << endl;
}
if(s > t) return int((s-1)/2);
int tt=t;
while(tt > s) tt = int((tt-1)/2);
if(tt != s) return C[0];
tt=t;
while(int((tt-1)/2) != s) tt=int((tt-1)/2);
return tt;
}
#ifdef ARTHUR_LOCAL
int main()
{
cout << "ANS: " << find_next_station(0, 6, {1, 2}) << endl;
}
#endif
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
729 ms |
860 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
560 ms |
996 KB |
Output is correct |
2 |
Correct |
599 ms |
768 KB |
Output is correct |
3 |
Correct |
1178 ms |
892 KB |
Output is correct |
4 |
Correct |
758 ms |
884 KB |
Output is correct |
5 |
Correct |
781 ms |
804 KB |
Output is correct |
6 |
Correct |
577 ms |
784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
543 ms |
768 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1029 ms |
888 KB |
Output is correct |
2 |
Incorrect |
958 ms |
768 KB |
Wrong query response. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
629 ms |
860 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |