結果

問題 No.1187 皇帝ペンギン
ユーザー Kude
提出日時 2020-08-28 00:37:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 64 ms / 1,000 ms
コード長 302 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 69,344 KB
平均クエリ数 17.19
最終ジャッジ日時 2024-07-17 06:49:10
合計ジャッジ時間 6,282 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

def q(x):
    print('?', x)
    return input() == 'safe'

def ans(x):
    print('!', x)
    return

if not q(1):
    ans(0)
    exit()
l = 1
r = 1000
while r - l > 1:
    c = (r + l) // 2
    if q(c):
        l = c
    else:
        if q(c+1):
            l = c+1
        else:
            r = c
ans(l)
0