結果

問題 No.1187 皇帝ペンギン
ユーザー toma
提出日時 2020-08-22 16:08:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 390 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,608 KB
平均クエリ数 16.48
最終ジャッジ日時 2024-07-17 06:31:06
合計ジャッジ時間 6,018 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

def query(X):
  print("? {}".format(X))
  return input()=="out"

def answer(X):
  print("! {}".format(X))

if __name__ == '__main__':
  safe, out = 0, 10**3
  while abs(safe-out) > 1:
    mid = (safe+out)//2
    isAngry = query(mid)
    if isAngry:
      isAngry = query(mid+1)
      if isAngry:
        out = mid
      else:
        safe = mid+1
    else:
      safe = mid
  answer(safe)

0