#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> id(n);
iota(id.begin(), id.end(), 0);
return id;
}
int find_next_station(int s, int t, std::vector<int> c) {
s++;
t++;
for (int& v : c) {
v++;
}
if (t < s) {
return (s >> 1) - 1;
} else {
std::vector<int> cnd;
for (int v : c) {
if (v > s) {
cnd.push_back(v);
}
}
if (cnd.size() == 1) {
return cnd[0] - 1;
} else {
int x = cnd[0];
int y = cnd[1];
while (true) {
if (t == x) {
return x - 1;
}
if (t == y) {
return y - 1;
}
t >>= 1;
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |