結果

問題 No.253 ロウソクの長さ
ユーザー takakintakakin
提出日時 2020-06-23 22:42:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 953 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 11,072 KB
実行使用メモリ 24,620 KB
平均クエリ数 21.25
最終ジャッジ日時 2023-09-24 02:40:01
合計ジャッジ時間 3,360 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
24,080 KB
testcase_01 AC 37 ms
24,312 KB
testcase_02 AC 36 ms
23,916 KB
testcase_03 AC 37 ms
24,032 KB
testcase_04 AC 37 ms
24,228 KB
testcase_05 AC 36 ms
23,972 KB
testcase_06 AC 39 ms
23,996 KB
testcase_07 AC 39 ms
24,116 KB
testcase_08 AC 38 ms
24,164 KB
testcase_09 AC 36 ms
24,464 KB
testcase_10 AC 38 ms
23,908 KB
testcase_11 AC 38 ms
24,248 KB
testcase_12 AC 39 ms
24,424 KB
testcase_13 AC 38 ms
24,148 KB
testcase_14 AC 38 ms
24,620 KB
testcase_15 AC 36 ms
24,088 KB
testcase_16 AC 38 ms
23,980 KB
testcase_17 AC 39 ms
24,312 KB
testcase_18 AC 38 ms
24,168 KB
testcase_19 AC 38 ms
24,020 KB
testcase_20 AC 38 ms
23,812 KB
testcase_21 AC 37 ms
24,364 KB
testcase_22 AC 38 ms
24,404 KB
testcase_23 AC 39 ms
24,444 KB
testcase_24 AC 38 ms
24,036 KB
testcase_25 AC 38 ms
23,892 KB
testcase_26 AC 38 ms
24,036 KB
testcase_27 AC 38 ms
24,160 KB
testcase_28 AC 39 ms
24,460 KB
testcase_29 AC 38 ms
24,168 KB
testcase_30 AC 37 ms
24,120 KB
testcase_31 AC 36 ms
24,300 KB
testcase_32 AC 38 ms
24,500 KB
testcase_33 AC 38 ms
24,172 KB
testcase_34 AC 38 ms
23,932 KB
testcase_35 AC 38 ms
23,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
print("?",100,flush=True)
ans=int(input())
if ans==0:
  print("!",100,flush=True)
elif ans==-1:
  l,r=10,100
  ct=1
  while r-l>1:
    mid=(l+r)//2
    print("?",max(0,mid-ct),flush=True)
    ct+=1
    ans=int(input())
    if ans==0:
      print("!",mid,flush=True)
      break

    elif ans==1:
      l=mid
    else:
      r=mid
  else:
    print("?",max(0,r-ct),flush=True)
    ct+=1
    ans=int(input())
    if ans==0:
      print("!",r,flush=True)
    else:
      print("!",l,flush=True)
else:
  l,r=100,10**9
  ct=1
  while r-l>1:
    mid=(l+r)//2
    print("?",max(0,mid-ct),flush=True)
    ct+=1
    ans=int(input())
    if ans==0:
      print("!",mid,flush=True)
      break

    elif ans==1:
      l=mid
    else:
      r=mid
  else:
    print("?",max(0,r-ct),flush=True)
    ct+=1
    ans=int(input())
    if ans==0:
      print("!",r,flush=True)
    else:
      print("!",l,flush=True)

0