結果
問題 |
No.253 ロウソクの長さ
|
ユーザー |
![]() |
提出日時 | 2016-09-27 22:28:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,073 bytes |
コンパイル時間 | 1,506 ms |
コンパイル使用メモリ | 158,920 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 2.00 |
最終ジャッジ日時 | 2024-07-16 11:07:30 |
合計ジャッジ時間 | 10,986 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 36 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; class Solver { public: bool solve(int test = -1) { ll l = 0, r = 1e10; int cnt = 90; while(cnt--) { ll m = (l + r) / 2; cout << "? " << m << endl; cout.flush(); int res; if( test < 0) { cin >> res; } else { res = test == m ? 0 : test > m ? 1 : -1; if(test > 0) test--; cerr << test << endl; } 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); int a; a = -1; //cin >> a; Solver s; s.solve(a); return 0; }