結果

問題 No.253 ロウソクの長さ
ユーザー beetbeet
提出日時 2018-12-05 15:56:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 1,950 ms
コンパイル使用メモリ 197,668 KB
実行使用メモリ 24,348 KB
平均クエリ数 48.83
最終ジャッジ日時 2023-09-23 16:36:08
合計ジャッジ時間 5,172 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,544 KB
testcase_01 AC 26 ms
23,556 KB
testcase_02 AC 26 ms
23,616 KB
testcase_03 AC 25 ms
23,616 KB
testcase_04 AC 24 ms
23,340 KB
testcase_05 WA -
testcase_06 AC 26 ms
23,580 KB
testcase_07 AC 26 ms
23,976 KB
testcase_08 AC 27 ms
23,976 KB
testcase_09 AC 24 ms
23,340 KB
testcase_10 AC 26 ms
23,484 KB
testcase_11 AC 27 ms
23,496 KB
testcase_12 AC 26 ms
23,640 KB
testcase_13 AC 25 ms
23,592 KB
testcase_14 AC 24 ms
23,928 KB
testcase_15 AC 26 ms
23,196 KB
testcase_16 AC 24 ms
24,156 KB
testcase_17 AC 25 ms
23,604 KB
testcase_18 AC 27 ms
24,240 KB
testcase_19 AC 23 ms
23,400 KB
testcase_20 AC 25 ms
24,276 KB
testcase_21 AC 25 ms
23,592 KB
testcase_22 AC 25 ms
24,264 KB
testcase_23 AC 25 ms
23,592 KB
testcase_24 AC 25 ms
23,604 KB
testcase_25 AC 25 ms
24,288 KB
testcase_26 AC 25 ms
24,288 KB
testcase_27 AC 25 ms
23,388 KB
testcase_28 AC 25 ms
24,168 KB
testcase_29 AC 25 ms
23,808 KB
testcase_30 AC 25 ms
24,348 KB
testcase_31 AC 26 ms
23,376 KB
testcase_32 AC 26 ms
24,060 KB
testcase_33 AC 26 ms
23,976 KB
testcase_34 AC 23 ms
24,264 KB
testcase_35 AC 26 ms
23,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    if(l+1==r) ans(l);
  }
  ans(l);
  return 0;
}
0