0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-05 02:26:26 +00:00
OI-codes/LibreOJ/6/6.cpp

32 lines
605 B
C++

#include <bits/stdc++.h>
#include "interaction.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;
}