# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1200492 | eyadooz | 기지국 (IOI20_stations) | C++20 | 0 ms | 0 KiB |
#include"routers.h"
// #include<bits/stdc++.h>
#include<vector>
using namespace std;
// int use_detector(int x)
// {
// cout << x << endl;
// int y;
// cin >> y;
// return y;
// }
std::vector<int> find_routers(int k, int n, int q)
{
vector<int> ans;
ans.push_back(0);
for(int i = 1;i<n;i++)
{
int l=0,r=k,bst;
while(l<=r)
{
int mid = (l+r)/2;
int x = use_detector(mid);
if(x<i) l=mid+1,bst=mid;
else r=mid-1;
}
ans.push_back(((bst-1)-ans.back())*2+ans.back());
}
return ans;
}
// int main()
// {
// vector<int> a= find_routers(6, 3, 10000);
// for(auto i : a) cout << i << " ";
// }