結果
| 問題 | No.246 質問と回答 |
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-03-26 19:28:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 693 bytes |
| 記録 | |
| コンパイル時間 | 704 ms |
| コンパイル使用メモリ | 63,872 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 32.90 |
| 最終ジャッジ日時 | 2024-07-16 20:15:32 |
| 合計ジャッジ時間 | 3,801 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
// No.246 質問と回答
// https://yukicoder.me/problems/no/246
//
#include <iostream>
using namespace std;
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int ub = 1000000000;
int lb = 1;
while (ub > lb + 4) {
int mid = (ub + lb) / 2;
cout << "? " << mid << flush << endl;
int res;
cin >> res;
if (res == 0)
ub = mid;
else
lb = mid;
}
for (int i = lb; i <= ub+1; ++i) {
cout << "? " << i << flush << endl;
int res;
cin >> res;
if (res == 0) {
cout << "! " << i - 1 << flush << endl;
break;
}
}
}
kichirb3