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 t[1005];
void bs(int l,int r,int a,int b){
if(a==b)return;
int m=(l+r)/2;
int c=use_detector(m);
t[c]=max(t[c],m);
if(a!=c&&m-l>1)bs(l,m,a,c);
if(c!=b&&r-m>1)bs(m,r,c,b);
}
vector<int> find_routers(int l, int n, int q) {
for(int i=0;i<n;i++)t[i]=-1;
t[n-1]=l;
bs(0,l,0,n-1);
vector<int>ans(n);
ans[0]=0;
for(int i=1;i<n;i++)ans[i]=2*t[i-1]-ans[i-1];
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... |