結果

問題 No.1187 皇帝ペンギン
ユーザー lemondolemondo
提出日時 2020-08-22 14:52:14
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 772 bytes
コンパイル時間 2,027 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 94,704 KB
平均クエリ数 12.76
最終ジャッジ日時 2023-09-24 06:06:27
合計ジャッジ時間 11,244 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 95 ms
92,184 KB
testcase_02 AC 84 ms
91,652 KB
testcase_03 AC 87 ms
92,136 KB
testcase_04 AC 84 ms
91,760 KB
testcase_05 AC 84 ms
91,552 KB
testcase_06 AC 85 ms
92,028 KB
testcase_07 AC 85 ms
91,472 KB
testcase_08 AC 84 ms
91,520 KB
testcase_09 AC 90 ms
91,388 KB
testcase_10 AC 87 ms
91,688 KB
testcase_11 RE -
testcase_12 AC 91 ms
91,744 KB
testcase_13 AC 96 ms
92,152 KB
testcase_14 AC 88 ms
91,708 KB
testcase_15 AC 82 ms
91,448 KB
testcase_16 AC 86 ms
92,108 KB
testcase_17 AC 87 ms
91,544 KB
testcase_18 AC 87 ms
91,564 KB
testcase_19 AC 84 ms
91,524 KB
testcase_20 AC 85 ms
91,652 KB
testcase_21 AC 86 ms
91,700 KB
testcase_22 AC 88 ms
91,796 KB
testcase_23 AC 86 ms
92,120 KB
testcase_24 AC 86 ms
91,856 KB
testcase_25 AC 85 ms
91,936 KB
testcase_26 AC 87 ms
91,476 KB
testcase_27 AC 87 ms
91,488 KB
testcase_28 AC 85 ms
91,364 KB
testcase_29 AC 86 ms
91,496 KB
testcase_30 AC 88 ms
91,808 KB
testcase_31 AC 85 ms
91,684 KB
testcase_32 AC 85 ms
91,472 KB
testcase_33 AC 85 ms
91,504 KB
testcase_34 AC 87 ms
91,760 KB
testcase_35 AC 86 ms
91,464 KB
testcase_36 AC 85 ms
91,920 KB
testcase_37 AC 87 ms
91,684 KB
testcase_38 AC 87 ms
91,736 KB
testcase_39 AC 89 ms
91,472 KB
testcase_40 AC 86 ms
91,816 KB
testcase_41 AC 84 ms
91,408 KB
testcase_42 AC 85 ms
91,836 KB
testcase_43 AC 84 ms
91,788 KB
testcase_44 AC 87 ms
91,408 KB
testcase_45 AC 85 ms
92,160 KB
testcase_46 AC 84 ms
92,024 KB
testcase_47 AC 86 ms
91,552 KB
testcase_48 AC 85 ms
91,820 KB
testcase_49 AC 89 ms
91,892 KB
testcase_50 AC 85 ms
91,796 KB
testcase_51 AC 86 ms
91,484 KB
testcase_52 AC 86 ms
91,920 KB
testcase_53 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

s = set()
primes = []
for i in range(2, 1001):
    if i in s:
        continue
    primes.append(i)
    cnt = 2
    while cnt*i<1001:
        s.add(cnt*i)
        cnt += 1
leng = len(primes)
l, r = 0, leng
cnt = 0
while l+1<r:
    half = (l+r)//2
    print('? {}'.format(primes[half]))
    sys.stdout.flush()
    cnt += 1
    answer = input()
    if answer=='safe':
        l = half
    else:
        r = half

right = primes[l+1]
for _ in range(cnt, 25):
    print('? {}'.format(right-1))
    sys.stdout.flush()
    if input()=='safe':
        break
    else:
        right -= 1
print('! {}'.format(right-1))
sys.stdout.flush()
exit()
0