0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-30 21:16:27 +00:00
OI-codes/LibreOJ/6/data/std.cpp

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