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>
#include "routers.h"
using namespace std;
vector<int> sz;
int el=0, id=0, c=128;
/*
int use_detector(int a) {
cout.flush() << a << "\n";
int x; cin >> x;
return x;
}
*/
vector<int> find_routers(int h, int n, int q) {
sz.push_back(0);
for (int i=1; i<n; i++) {
/*
int kis=el+1, nagy=min(h, el+c);
while(use_detector(nagy)==id) {
kis=nagy, nagy=min(h, nagy+c);
}
*/
int kis=el+1, nagy=h;
while(nagy-kis>1) {
int koz=(nagy+kis)/2;
if (use_detector(koz)==id) kis=koz;
else nagy=koz;
}
sz.push_back(2*kis-el), el=sz.back(), id++;
}
return sz;
}
# | 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... |