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 ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int) (x).size())
using namespace std;
int use_detector(int x);
vector<int> find_routers(int l, int n, int q){
vector<int> ans(n);
vector<int> maxpos(n, l);
ans[0] = 0;
int last = 0;
for(int i = 1; i < n; i++){
int l = last, r = maxpos[i];
while(r - l > 1){
int m = (l + r) / 2;
int index = use_detector(m);
maxpos[index] = min(m, maxpos[index]);
if(index != i-1)
r = m;
else
l = m;
}
ans[i] = 2 * ((r - 1) - last) + last;
last = ans[i];
}
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... |