# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1038610 | eysbutno | Finding Routers (IOI20_routers) | C++17 | 0 ms | 0 KiB |
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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = array<int, 2>;
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
vector<int> find_routers(int l, int n, int q) {
vector<int> res(n);
for (int i = 1; i < n; i++) {
int lo = res[i - 1] + 1, hi = l - 1;
while (lo < hi) {
int mi = (lo + hi + 1) / 2;
use_detector(mi) == i - 1 ? lo = mi : hi = mi - 1;
}
res[i] = res[i - 1] + 2 * (lo - res[i - 1]);
}
return res;
}