結果

問題 No.305 鍵(2)
ユーザー 👑 H20H20
提出日時 2022-01-02 12:44:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 92,616 KB
平均クエリ数 55.15
最終ジャッジ日時 2023-09-24 03:01:43
合計ジャッジ時間 2,666 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
87,924 KB
testcase_01 AC 100 ms
87,896 KB
testcase_02 AC 101 ms
88,088 KB
testcase_03 AC 106 ms
87,712 KB
testcase_04 AC 101 ms
88,252 KB
testcase_05 AC 132 ms
92,616 KB
testcase_06 AC 101 ms
87,908 KB
testcase_07 AC 101 ms
88,288 KB
testcase_08 AC 102 ms
88,248 KB
testcase_09 AC 104 ms
88,156 KB
testcase_10 AC 100 ms
88,028 KB
testcase_11 AC 102 ms
87,936 KB
testcase_12 AC 103 ms
88,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import random
readline = sys.stdin.readline
write = sys.stdout.write
flush = sys.stdout.flush

# クエリ: "? x1 x2" を出力
def query(x):
    s = str(x).zfill(10)
    write("%s\n" % s)
    flush()
    # ジャッジから返される値を取得
    n,l  = readline().strip().split()
    if l == 'unlocked':
        exit(0)
    
    return int(n)


while True:
    r = random.randint(0, 10**10-1)
    n = query(r)
    if n==0:
        break

q = list(str(r).zfill(10))

for i in range(10):
    for j in range(10):
        q[i]=j
        x = int(''.join(map(str, q)))
        if query(x)==i+1:
            break
0