#include "routers.h"
#include <vector>
using namespace std;
std::vector<int> find_routers(int l, int n, int q) {
vector<int> pos(n);
pos[0] = 0;
for (int i = 1; i < n; ++i) {
int lo = pos[i - 1] + 2;
int hi = l;
int res = l;
while (lo <= hi) {
int mid = ((lo + hi) / 2) / 2 * 2;
int label = use_detector(mid);
if (label >= i) {
res = mid;
hi = mid - 2;
} else {
lo = mid + 2;
}
}
pos[i] = 2 * res - pos[i - 1];
}
return pos;
}
# | 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... |