0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-05 14:38:48 +00:00
OI-codes/LibreOJ/6/6.cpp

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;
}