# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
562492 | Iwanttobreakfree | Finding Routers (IOI20_routers) | C++17 | 2 ms | 704 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 <vector>
using namespace std;
vector<int> guarda(100001,-1);
vector<int> find_routers(int lon, int n, int q) {
vector<int> ans(n);
vector<int> maxinum(n,0);
vector<int> mininum(n,lon);
ans[0]=0;
int l=0,r;
for(int i=1;i<n;i++){
l=maxinum[i-1];
r=mininum[i];
int sol;
while(l<=r){
int mid=(r-l)/2+l,cerc;
if(guarda[mid]==-1)cerc=guarda[mid]=use_detector(mid);
else cerc=guarda[mid];
if(cerc<i){
l=mid+1;
sol=mid;
}
else{
r=mid-1;
}
if(maxinum[cerc]<mid)maxinum[cerc]=mid;
if(mininum[cerc]>mid)mininum[cerc]=mid;
}
ans[i]=2*sol-ans[i-1];
}
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... |