結果
| 問題 | No.253 ロウソクの長さ |
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2018-12-05 15:58:00 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 641 bytes |
| 記録 | |
| コンパイル時間 | 1,778 ms |
| コンパイル使用メモリ | 192,820 KB |
| 最終ジャッジ日時 | 2025-01-06 18:17:19 |
|
ジャッジサーバーID (参考情報) |
judge4 / 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) ans(m);
if(y>0) l=m;
if(y<0) r=m;
}
ans(l);
return 0;
}
beet