# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
624239 | MatesV13 | Finding Routers (IOI20_routers) | C++17 | 0 ms | 0 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 <bits/stdc++.h>
using namespace std;
int rezultati[100005];
int nadi(int lo, int hi, int val){
if (lo==hi) return lo;
int mid = (lo+hi+1)/2;
if (!rezultati[mid])
rezultati[mid] = use_detector(mid) + 1;
int odgovor = rezultati[mid]-1;
if (odgovor >= val) return nadi(lo, mid-1, val);
return nadi (mid, hi, val);
}
vector<int> find_routers(int l, int n, int q){
vector<int> poz;
poz.push_back(0);
while (poz.size() != n){
int temp = nadi(0, l, poz.size());
int idx = 2*temp-poz[poz.size()-1];
poz.push_back(idx);
}
return poz;
}