結果
| 問題 | No.253 ロウソクの長さ |
| コンテスト | |
| ユーザー |
cormoran
|
| 提出日時 | 2016-09-27 22:18:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| 記録 | |
| コンパイル時間 | 1,411 ms |
| コンパイル使用メモリ | 159,364 KB |
| 実行使用メモリ | 25,716 KB |
| 平均クエリ数 | 2.00 |
| 最終ジャッジ日時 | 2024-07-16 11:07:03 |
| 合計ジャッジ時間 | 10,375 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
class Solver {
public:
bool solve() {
ll l = 0, r = 1e10;
int cnt = 90;
while(cnt--) {
ll m = (l + r) / 2;
cout << "? " << m << endl;
cout.flush();
int res; cin >> res;
if(res > 0) l = m;
if(res < 0) {
r = m;
if(l > 0) l--;
}
if(res == 0) {
cout << "! " << max(m - 1, 0LL) << endl;
exit(0);
}
}
cout << "! " << l << endl;
return 0;
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
Solver s;
s.solve();
return 0;
}
cormoran