結果

問題 No.355 数当てゲーム(2)
ユーザー MitI_7MitI_7
提出日時 2016-04-04 12:54:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 1,461 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 24,976 KB
平均クエリ数 5.52
最終ジャッジ日時 2023-09-23 23:41:51
合計ジャッジ時間 5,627 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
24,792 KB
testcase_01 AC 49 ms
24,364 KB
testcase_02 AC 48 ms
24,808 KB
testcase_03 AC 46 ms
24,252 KB
testcase_04 AC 48 ms
24,524 KB
testcase_05 AC 47 ms
24,592 KB
testcase_06 AC 50 ms
24,512 KB
testcase_07 AC 46 ms
24,696 KB
testcase_08 AC 46 ms
24,380 KB
testcase_09 AC 48 ms
24,564 KB
testcase_10 AC 48 ms
24,444 KB
testcase_11 AC 47 ms
24,732 KB
testcase_12 AC 47 ms
24,952 KB
testcase_13 AC 50 ms
24,900 KB
testcase_14 AC 50 ms
24,640 KB
testcase_15 AC 46 ms
24,324 KB
testcase_16 AC 48 ms
24,244 KB
testcase_17 AC 48 ms
24,140 KB
testcase_18 AC 46 ms
24,800 KB
testcase_19 AC 49 ms
24,804 KB
testcase_20 AC 46 ms
24,800 KB
testcase_21 AC 48 ms
24,336 KB
testcase_22 AC 46 ms
24,520 KB
testcase_23 AC 51 ms
24,868 KB
testcase_24 AC 46 ms
24,412 KB
testcase_25 AC 48 ms
24,900 KB
testcase_26 AC 48 ms
24,900 KB
testcase_27 AC 48 ms
24,516 KB
testcase_28 AC 53 ms
24,724 KB
testcase_29 AC 47 ms
24,888 KB
testcase_30 AC 49 ms
24,876 KB
testcase_31 AC 50 ms
24,492 KB
testcase_32 AC 47 ms
24,476 KB
testcase_33 AC 48 ms
24,484 KB
testcase_34 AC 48 ms
24,724 KB
testcase_35 AC 39 ms
24,676 KB
testcase_36 AC 47 ms
24,456 KB
testcase_37 AC 47 ms
24,328 KB
testcase_38 AC 49 ms
24,588 KB
testcase_39 AC 48 ms
24,700 KB
testcase_40 AC 46 ms
24,944 KB
testcase_41 AC 48 ms
24,344 KB
testcase_42 AC 47 ms
24,756 KB
testcase_43 AC 50 ms
24,352 KB
testcase_44 AC 47 ms
24,584 KB
testcase_45 AC 48 ms
24,820 KB
testcase_46 AC 47 ms
24,928 KB
testcase_47 AC 50 ms
24,424 KB
testcase_48 AC 48 ms
24,372 KB
testcase_49 AC 48 ms
24,712 KB
testcase_50 AC 48 ms
24,824 KB
testcase_51 AC 45 ms
24,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations, filterfalse


def judge(a, b):
    x, y = 0, 0
    for i in range(len(a)):
        if a[i] == b[i]:
            x += 1
    y = 8 - len(set(list(a) + list(b))) - x
    return x, y


def main():
    ans = list(permutations("0123456789", 4))
    while True:
        q = ans[0]
        print(" ".join(q))
        x, y = map(int, input().split())

        if (x, y) == (4, 0):
            return
        else:
            ans = list(filterfalse(lambda n: judge(n, q) != (x, y), ans))

if __name__ == '__main__':
    main()
0