結果
問題 |
No.253 ロウソクの長さ
|
ユーザー |
![]() |
提出日時 | 2018-12-05 15:55:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 618 bytes |
コンパイル時間 | 1,523 ms |
コンパイル使用メモリ | 192,828 KB |
最終ジャッジ日時 | 2025-01-06 18:16:45 |
ジャッジサーバーID (参考情報) |
judge1 / 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<50;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; } ans(l); return 0; }