結果

問題 No.305 鍵(2)
コンテスト
ユーザー H20
提出日時 2022-01-02 12:44:01
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 625 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 156 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 79,264 KB
平均クエリ数 55.77
最終ジャッジ日時 2026-03-31 16:49:18
合計ジャッジ時間 1,745 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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