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 rb[1005];
int ans[1005];
void search(int a) {
int l = ans[a - 1] + 1, r = rb[a];
cerr << l << ' ' << r << '\n';
while(l < r) {
int m = (l + r + 1) / 2;
int x = use_detector(m);
for(int i = a; i <= x; i++) rb[i] = min(rb[i], m);
if(x == a - 1) l = m;
else r = m - 1;
}
ans[a] = (l - ans[a - 1]) * 2 + ans[a - 1];
return;
}
vector<int> find_routers(int l, int n, int q) {
for(int i = 0; i < n; i++) rb[i] = l;
ans[0] = 0;
for(int i = 1; i < n; i++) search(i);
vector<int> rt;
for(int i = 0; i < n; i++) rt.emplace_back(ans[i]);
return rt;
}
# | 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... |