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 i, mx[1005];
void compute(int lo, int hi, int x, int y) {
if (x == y) return;
int mid = (lo+hi)/2;
int curr = use_detector(mid);
mx[curr] = max(mx[curr], mid);
if (x != curr && mid-lo > 1) {
compute(lo, mid, x, curr);
}
if (y != curr && hi-mid > 1) {
compute(mid, hi, curr, y);
}
}
vector<int> find_routers(int l, int n, int q) {
vector<int> ans(n);
fill(mx, mx+n, -1);
mx[n-1] = l;
compute(0, l, 0, n-1);
ans[0] = 0;
for (i=1; i < n; ++i) {
ans[i] = 2*mx[i-1]-ans[i-1];
}
return ans;
}
# | 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... |