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>
#define FOR(i,l,r) for(int i=(l); i<=(r); ++i)
#define REP(i,l,r) for(int i=(l); i<(r); ++i)
#define FORD(i,r,l) for(int i=(r); i>=(l); --i)
#define REPD(i,r,l) for(int i=(r)-1; i>=(l); --i)
using namespace std;
int ans[1005];
int use_detector(int x);
int ask(int x) {
int tmp = use_detector(x);
return tmp;
}
void solve(int l, int r, int numx, int numy) {
if (l > r) return;
if (numx == numy) {
ans[numx] = r;
return;
}
int mid = (l + r) / 2;
int tmp = ask(mid);
solve(l, mid - 1, numx, tmp);
ans[tmp] = mid;
solve(mid + 1, r, tmp, numy);
}
vector<int> find_routers(int l, int n, int q) {
solve(0, l, 0, n - 1);
vector<int> List(n, 0);
REP(i, 1, n) List[i] = ans[i - 1] * 2 - List[i - 1];
return List;
}
# | 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... |