#include "stations.h"
#include <vector>
#define pb push_back
using namespace std;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
for (int i = 0; i < n; ++i) {
labels[i] = i;
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
int level_s = 0, level_t = 0;
int x = s;
while (x > 0) level_s++, x/=2;
if (s == (1 << (level_s + 1)) - 1) level_s++;
x = t;
while (x > 0) level_t++, x/=2;
if (t == (1 << (level_t + 1)) - 1) level_t++;
int a = s;
int b = t;
while (level_s > level_t) a = (a-1) / 2, level_s--;
if (a == b){
while ((s-1)/2 != t) s = (s-1) / 2;
return s;
}
else return (t-1)/2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
636 ms |
456 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
487 ms |
400 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
667 ms |
480 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1101 ms |
528 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
602 ms |
400 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |