結果
| 問題 | No.3212 SUPER Guess the Number |
| コンテスト | |
| ユーザー |
rieaaddlreiuu
|
| 提出日時 | 2026-05-14 20:06:20 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 938 bytes |
| 記録 | |
| コンパイル時間 | 1,213 ms |
| コンパイル使用メモリ | 179,792 KB |
| 実行使用メモリ | 30,052 KB |
| 平均クエリ数 | 21.75 |
| 最終ジャッジ日時 | 2026-05-14 20:06:31 |
| 合計ジャッジ時間 | 2,481 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int L = 1, R = 1000000;
long long prev = 1;
cout << "? " << prev << endl;
cout.flush();
while (L < R) {
int mid = (L + R) / 2;
long long x = 2LL * mid + 1 - prev;
cout << "? " << x << endl;
cout.flush();
int res;
cin >> res;
if (res == -1) return 0;
if (x > prev) {
// res = 1 <=> |a-prev| >= |a-x|
// <=> a >= mid + 1
if (res == 1) {
L = mid + 1;
} else {
R = mid;
}
} else {
// x < prev のときは向きが逆
// res = 1 <=> a <= mid
if (res == 1) {
R = mid;
} else {
L = mid + 1;
}
}
prev = x;
}
cout << "! " << L << endl;
cout.flush();
return 0;
}
rieaaddlreiuu