結果

問題 No.355 数当てゲーム(2)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-04-02 14:13:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 677 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 25,032 KB
平均クエリ数 5.52
最終ジャッジ日時 2023-09-23 23:35:41
合計ジャッジ時間 4,815 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
24,204 KB
testcase_01 AC 45 ms
24,588 KB
testcase_02 AC 42 ms
24,632 KB
testcase_03 AC 40 ms
24,760 KB
testcase_04 AC 42 ms
24,384 KB
testcase_05 AC 45 ms
24,328 KB
testcase_06 AC 43 ms
24,392 KB
testcase_07 AC 40 ms
24,436 KB
testcase_08 AC 39 ms
24,344 KB
testcase_09 AC 40 ms
24,468 KB
testcase_10 AC 42 ms
24,956 KB
testcase_11 AC 42 ms
24,576 KB
testcase_12 AC 41 ms
24,716 KB
testcase_13 AC 40 ms
24,332 KB
testcase_14 AC 44 ms
24,704 KB
testcase_15 AC 43 ms
24,860 KB
testcase_16 AC 42 ms
24,768 KB
testcase_17 AC 42 ms
24,448 KB
testcase_18 AC 39 ms
24,596 KB
testcase_19 AC 44 ms
24,920 KB
testcase_20 AC 43 ms
24,800 KB
testcase_21 AC 42 ms
24,360 KB
testcase_22 AC 41 ms
24,500 KB
testcase_23 AC 42 ms
24,832 KB
testcase_24 AC 40 ms
24,688 KB
testcase_25 AC 42 ms
24,404 KB
testcase_26 AC 44 ms
24,428 KB
testcase_27 AC 44 ms
24,588 KB
testcase_28 AC 42 ms
24,840 KB
testcase_29 AC 41 ms
24,684 KB
testcase_30 AC 41 ms
24,416 KB
testcase_31 AC 43 ms
24,664 KB
testcase_32 AC 40 ms
24,808 KB
testcase_33 AC 43 ms
24,956 KB
testcase_34 AC 40 ms
24,460 KB
testcase_35 AC 33 ms
24,644 KB
testcase_36 AC 40 ms
25,032 KB
testcase_37 AC 40 ms
24,964 KB
testcase_38 AC 44 ms
24,180 KB
testcase_39 AC 45 ms
24,444 KB
testcase_40 AC 41 ms
24,920 KB
testcase_41 AC 43 ms
24,728 KB
testcase_42 AC 42 ms
24,712 KB
testcase_43 AC 43 ms
24,680 KB
testcase_44 AC 41 ms
24,756 KB
testcase_45 AC 41 ms
24,456 KB
testcase_46 AC 40 ms
24,600 KB
testcase_47 AC 42 ms
24,904 KB
testcase_48 AC 43 ms
24,280 KB
testcase_49 AC 42 ms
24,684 KB
testcase_50 AC 42 ms
24,524 KB
testcase_51 AC 42 ms
24,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as itr

digits = list(range(10))
cands = [x for x in itr.permutations(digits, 4)]
nxt_cands = []

while True:
    # 適当に先頭のクエリを投げる
    query = cands[0]
    print(*query)
    x, y = map(int, input().split())
    if (x, y) == (4, 0):
        exit()

    # 返ってきた答えに合致する候補だけ残す
    for cand in cands[1:]:
        t_x, t_y = 0, 0
        for (j, digit) in enumerate(query):
            if cand[j] == digit:
                t_x += 1
            elif digit in cand:
                t_y += 1
        if (t_x, t_y) == (x, y):
            nxt_cands.append(cand)

    cands = list(nxt_cands)
    nxt_cands = []
0