結果

問題 No.1187 皇帝ペンギン
ユーザー ntudantuda
提出日時 2022-03-08 22:20:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 846 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 87,724 KB
平均クエリ数 13.57
最終ジャッジ日時 2023-10-01 04:46:21
合計ジャッジ時間 9,177 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
87,172 KB
testcase_01 AC 94 ms
87,724 KB
testcase_02 AC 95 ms
87,200 KB
testcase_03 AC 96 ms
87,112 KB
testcase_04 AC 94 ms
87,480 KB
testcase_05 AC 94 ms
87,500 KB
testcase_06 AC 93 ms
87,052 KB
testcase_07 AC 95 ms
87,012 KB
testcase_08 AC 95 ms
87,388 KB
testcase_09 AC 96 ms
87,232 KB
testcase_10 AC 95 ms
86,848 KB
testcase_11 WA -
testcase_12 AC 94 ms
87,540 KB
testcase_13 AC 96 ms
87,112 KB
testcase_14 AC 95 ms
87,068 KB
testcase_15 AC 96 ms
87,620 KB
testcase_16 AC 95 ms
87,212 KB
testcase_17 AC 97 ms
87,304 KB
testcase_18 AC 97 ms
86,600 KB
testcase_19 AC 93 ms
87,316 KB
testcase_20 AC 94 ms
86,984 KB
testcase_21 AC 93 ms
87,024 KB
testcase_22 AC 96 ms
87,504 KB
testcase_23 AC 96 ms
87,576 KB
testcase_24 AC 98 ms
87,520 KB
testcase_25 AC 95 ms
87,692 KB
testcase_26 AC 96 ms
86,992 KB
testcase_27 AC 95 ms
86,836 KB
testcase_28 AC 95 ms
87,516 KB
testcase_29 AC 95 ms
87,164 KB
testcase_30 AC 94 ms
86,696 KB
testcase_31 AC 97 ms
87,188 KB
testcase_32 AC 97 ms
87,332 KB
testcase_33 AC 97 ms
87,232 KB
testcase_34 AC 95 ms
87,396 KB
testcase_35 AC 95 ms
87,244 KB
testcase_36 AC 96 ms
87,052 KB
testcase_37 AC 94 ms
87,300 KB
testcase_38 AC 95 ms
87,156 KB
testcase_39 AC 95 ms
87,592 KB
testcase_40 AC 95 ms
86,924 KB
testcase_41 AC 93 ms
87,244 KB
testcase_42 AC 94 ms
87,024 KB
testcase_43 AC 94 ms
87,464 KB
testcase_44 AC 95 ms
87,228 KB
testcase_45 AC 95 ms
87,268 KB
testcase_46 AC 96 ms
87,700 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 97 ms
87,352 KB
testcase_53 AC 99 ms
87,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#N = 5
#D = 2

def make_divisors(n):
    divisors = []  #必要に応じてsetにしても良いかも
    i = 1
    while i ** 2 <= n:
        if n % i == 0:
            divisors.append(i)
            if i ** 2 != n:
                divisors.append(n//i)
        i += 1
    divisors.sort()
    return divisors

def check(x):
     print("?",x)
     return input() == "safe"
    # return x < N and x % D != 0

def search(lb,d):
    ub = 1000
    while ub - lb > 1:
        mid = (ub + lb) // 2
        if mid % d == 0:
            mid += 1
        if check(mid):
            lb = mid
        else:
            ub = mid
    return lb

x = search(0,1000)
if check(x+2):
    DL = make_divisors(x)
    for i in DL:
        if check(i):
            continue
        else:
            break
    y = search(x+2,i)
    print("!",y)
else:
    print("!",x)
0