結果
| 問題 | No.246 質問と回答 |
| コンテスト | |
| ユーザー |
not_522
|
| 提出日時 | 2015-08-04 11:59:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 469 bytes |
| 記録 | |
| コンパイル時間 | 1,154 ms |
| コンパイル使用メモリ | 159,188 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 30.90 |
| 最終ジャッジ日時 | 2024-07-16 07:44:26 |
| 合計ジャッジ時間 | 4,267 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long binarySearch(function<bool(long long)> func, long long include, long long exclude) {
while (abs(exclude - include) > 1) {
long long middle = (include + exclude) / 2;
(func(middle) ? include : exclude) = middle;
}
return include;
}
int main() {
auto f = [](int m){
cout << "? " << m << endl;
int res;
cin >> res;
return res;
};
cout << binarySearch(f, 1, 1e9 + 1) << endl;
}
not_522