#include "routers.h"
#include<bits/stdc++.h>
using namespace std;
/*int use_detector(int x){
int tem;
cout<<x;
cin>>tem;
return tem;
}*/
vector<int> find_routers(int mx, int n, int q){
//call with: use_detector(x);
vector<int> ans;
ans.push_back(0);
for(int i=1;i<=n;i++){
int cur=0;
int l=0,r=mx,mid;
while(l<=r){
mid=(l+r)/2;
int tem=use_detector(mid);
if(tem==i) cur=mid,l=mid+1;
if(tem<i) l=mid+1;
else r=mid-1;
}
ans.push_back((cur*2)-ans[i-1]);
//ans.push_back(cur+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... |