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>
#include "routers.h"
using namespace std;
#define ve vector
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 10;
int L;
int use(int x) {
if (x > L) return INF;
else return use_detector(x);
}
ve<int> find_routers(int l, int n, int q) {
ve<int> Ans(n);
L = l;
int p = 0;
for (int i = 1; i < n; i++) {
int x = 2;
while (use(p + x) == i - 1) {
x <<= 1;
}
int a = p + x;
x >>= 1;
while (x != 0) {
if (use(a - x) != i - 1) {
a -= x;
}
x >>= 1;
}
p = p + 2 * (a - p - 1);
Ans[i] = p;
}
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... |