mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 22:48:48 +00:00
22 lines
371 B (Stored with Git LFS)
C++
22 lines
371 B (Stored with Git LFS)
C++
#include "interaction.h"
|
|
|
|
inline int solve(int i) {
|
|
int l = 0, r = 1000000;
|
|
while (l < r) {
|
|
int mid = l + (r - l) / 2;
|
|
if (guess(i, mid) >= 0) r = mid;
|
|
else l = mid + 1;
|
|
}
|
|
return l;
|
|
}
|
|
|
|
int main() {
|
|
int n = get_num();
|
|
std::vector<int> a(n);
|
|
for (int i = 0; i < n; i++) {
|
|
a[i] = solve(i);
|
|
}
|
|
|
|
submit(a);
|
|
}
|