# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
641291 | knon0501 | Finding Routers (IOI20_routers) | C++14 | 2 ms | 724 KiB |
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 memo[100005];
std::vector<int> find_routers(int l, int n, int q) {
vector<int> ans={0};
// cout<<l<<" "<<n<<" "<<q<<endl;
for(int i=1 ; i<n ; i++){
int lef=ans[i-1]+1;
int rig=l;
int k;
while ((rig>=lef))
{
int mid=lef+rig>>1;
int x;
if(memo[mid]){
x=memo[mid];
}
else
x=use_detector(mid);
memo[mid]=x;
if(x<=i-1){
k=mid;
lef=mid+1;
}
else{
rig=mid-1;
}
}
ans.push_back(2*k-ans[i-1]);
// cout<<i<<" "<<ans[i]<<"!\n";
}
return ans;
}
Compilation message (stderr)
# | 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... |