mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-28 07:36:27 +00:00
31 lines
604 B
C++
31 lines
604 B
C++
|
#include "interaction.h"
|
||
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int n;
|
||
|
vector<int> ans;
|
||
|
|
||
|
int main() {
|
||
|
n = get_num();
|
||
|
for (int i = 0; i < n; i++) {
|
||
|
int l = 0, r = 1000000;
|
||
|
|
||
|
while (l <= r) {
|
||
|
int mid = (l + r) >> 1, feedback = guess(i, mid);
|
||
|
|
||
|
if (!feedback) {
|
||
|
ans.emplace_back(mid);
|
||
|
break;
|
||
|
} else {
|
||
|
if (feedback > 0) {
|
||
|
r = mid - 1;
|
||
|
} else {
|
||
|
l = mid + 1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
submit(ans);
|
||
|
return 0;
|
||
|
}
|