結果

問題 No.1187 皇帝ペンギン
ユーザー lemondolemondo
提出日時 2020-08-22 14:54:02
言語 PyPy3
(7.3.13)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 813 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 92,412 KB
平均クエリ数 12.83
最終ジャッジ日時 2023-09-24 06:06:37
合計ジャッジ時間 9,297 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
91,936 KB
testcase_01 AC 90 ms
91,864 KB
testcase_02 AC 83 ms
91,668 KB
testcase_03 AC 94 ms
91,608 KB
testcase_04 AC 89 ms
91,996 KB
testcase_05 AC 89 ms
91,696 KB
testcase_06 AC 88 ms
92,108 KB
testcase_07 AC 87 ms
91,948 KB
testcase_08 AC 85 ms
92,176 KB
testcase_09 AC 87 ms
92,288 KB
testcase_10 AC 85 ms
91,632 KB
testcase_11 AC 86 ms
91,532 KB
testcase_12 AC 85 ms
91,836 KB
testcase_13 AC 87 ms
91,572 KB
testcase_14 AC 89 ms
91,548 KB
testcase_15 AC 86 ms
91,540 KB
testcase_16 AC 85 ms
91,944 KB
testcase_17 AC 89 ms
91,676 KB
testcase_18 AC 85 ms
91,812 KB
testcase_19 AC 87 ms
91,772 KB
testcase_20 AC 85 ms
91,348 KB
testcase_21 AC 84 ms
92,412 KB
testcase_22 AC 85 ms
91,492 KB
testcase_23 AC 84 ms
91,552 KB
testcase_24 AC 85 ms
91,796 KB
testcase_25 AC 85 ms
91,436 KB
testcase_26 AC 84 ms
91,860 KB
testcase_27 AC 89 ms
91,676 KB
testcase_28 AC 87 ms
91,864 KB
testcase_29 AC 83 ms
91,616 KB
testcase_30 AC 92 ms
91,636 KB
testcase_31 AC 90 ms
91,812 KB
testcase_32 AC 85 ms
92,084 KB
testcase_33 AC 88 ms
91,556 KB
testcase_34 AC 85 ms
91,776 KB
testcase_35 AC 91 ms
91,652 KB
testcase_36 AC 85 ms
92,116 KB
testcase_37 AC 85 ms
91,672 KB
testcase_38 AC 84 ms
91,356 KB
testcase_39 AC 86 ms
92,040 KB
testcase_40 AC 84 ms
91,796 KB
testcase_41 AC 85 ms
91,828 KB
testcase_42 AC 83 ms
92,280 KB
testcase_43 AC 84 ms
92,112 KB
testcase_44 AC 85 ms
92,220 KB
testcase_45 AC 84 ms
91,860 KB
testcase_46 AC 86 ms
91,752 KB
testcase_47 AC 84 ms
91,876 KB
testcase_48 AC 90 ms
91,924 KB
testcase_49 AC 84 ms
92,116 KB
testcase_50 AC 86 ms
91,948 KB
testcase_51 AC 86 ms
91,788 KB
testcase_52 AC 86 ms
91,740 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

if l!=leng-1:
    right = primes[l+1]
else:
    right = 1000
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