0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-18 19:51:59 +00:00
OI-codes/LibreOJ/6/6.cpp

32 lines
605 B
C++
Raw Normal View History

#include <bits/stdc++.h>
2021-11-19 09:01:13 +00:00
#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;
}