結果
問題 |
No.253 ロウソクの長さ
|
ユーザー |
![]() |
提出日時 | 2018-12-05 15:57:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 641 bytes |
コンパイル時間 | 1,674 ms |
コンパイル使用メモリ | 192,896 KB |
最終ジャッジ日時 | 2025-01-06 18:17:06 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 WA * 1 |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} //INSERT ABOVE HERE Int ask(Int x){ cout<<"? "<<x<<endl; Int res; cin>>res; return res; } Int ans(Int x){ cout<<"! "<<x<<endl; exit(0); } signed main(){ Int l=10,r=1e9+100; for(Int i=0;i<40;i++){ Int x=ask(10); if(x==0) ans(10+i*2); if(x==-1) ans(10+i*2-1); Int m=(l+r)>>1; Int y=ask(m-(i*2+1)); if(y>=0) l=m; else r=m; if(l+1==r) ans(l); } ans(l); return 0; }