This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "routers.h"
#include <bits/stdc++.h>
using namespace std;
int mem[100005];
int ask(int x){
if (mem[x] == -1) mem[x] = use_detector(x);
return mem[x];
}
vector<int> find_routers(int len, int n, int q){
fill(mem, mem + len + 1, -1);
vector<int> p(n);
for (int i = 1; i < n; i++){
int l = p[i - 1] + 1, r = len;
while (l <= r) {
int m = (l + r) >> 1;
if (ask(m) == i - 1){
l = m + 1;
} else r = m - 1;
}
l--;
p[i] = 2 * l - p[i - 1];
}
return p;
}
# | 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... |