結果

問題 No.355 数当てゲーム(2)
ユーザー convexineqconvexineq
提出日時 2021-03-31 04:49:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 94,036 KB
平均クエリ数 5.12
最終ジャッジ日時 2023-09-24 02:55:49
合計ジャッジ時間 10,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
93,260 KB
testcase_01 AC 131 ms
93,840 KB
testcase_02 AC 122 ms
93,916 KB
testcase_03 AC 128 ms
93,528 KB
testcase_04 AC 137 ms
93,400 KB
testcase_05 AC 129 ms
93,556 KB
testcase_06 AC 130 ms
93,888 KB
testcase_07 AC 141 ms
93,836 KB
testcase_08 AC 126 ms
93,764 KB
testcase_09 AC 129 ms
93,728 KB
testcase_10 AC 124 ms
93,684 KB
testcase_11 AC 137 ms
93,660 KB
testcase_12 AC 131 ms
93,944 KB
testcase_13 AC 135 ms
93,608 KB
testcase_14 AC 138 ms
93,608 KB
testcase_15 AC 121 ms
93,252 KB
testcase_16 AC 138 ms
93,340 KB
testcase_17 AC 131 ms
93,932 KB
testcase_18 AC 130 ms
93,808 KB
testcase_19 AC 131 ms
93,420 KB
testcase_20 AC 125 ms
93,708 KB
testcase_21 AC 140 ms
93,740 KB
testcase_22 AC 133 ms
94,036 KB
testcase_23 AC 139 ms
93,324 KB
testcase_24 AC 133 ms
93,304 KB
testcase_25 AC 140 ms
93,932 KB
testcase_26 AC 126 ms
93,276 KB
testcase_27 AC 130 ms
93,888 KB
testcase_28 AC 131 ms
93,600 KB
testcase_29 AC 135 ms
93,724 KB
testcase_30 AC 127 ms
93,948 KB
testcase_31 AC 124 ms
93,460 KB
testcase_32 AC 132 ms
93,568 KB
testcase_33 AC 123 ms
93,932 KB
testcase_34 AC 128 ms
93,520 KB
testcase_35 AC 130 ms
93,644 KB
testcase_36 AC 134 ms
93,588 KB
testcase_37 AC 133 ms
93,536 KB
testcase_38 AC 124 ms
93,656 KB
testcase_39 AC 127 ms
93,924 KB
testcase_40 AC 125 ms
93,328 KB
testcase_41 AC 124 ms
93,636 KB
testcase_42 AC 130 ms
93,576 KB
testcase_43 AC 130 ms
93,476 KB
testcase_44 AC 126 ms
93,916 KB
testcase_45 AC 132 ms
93,664 KB
testcase_46 AC 128 ms
93,952 KB
testcase_47 AC 125 ms
93,692 KB
testcase_48 AC 127 ms
93,932 KB
testcase_49 AC 133 ms
93,576 KB
testcase_50 AC 135 ms
93,592 KB
testcase_51 AC 130 ms
93,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def g(x,v):
    aa = bb = 0
    for i in range(4):
        if v[i] == x[i]:
            aa += 1
        elif v[i] in x:
            bb += 1
    return aa,bb

def check(x,v,a,b):
    aa,bb = g(x,v)
    return aa==a and bb==b

def query(v):
    print(*v)
    if DEBUG:
        a,b = g(v,ans)
    else:
        a,b = map(int,input().split())
    return a,b

DEBUG = 0
ans = "1864"

from itertools import permutations
s = {"".join(map(str,i)) for i in permutations(range(10),4)}
c = 0
while True:
    v = s.pop()
    a,b = query(v)
    if a==4:
        exit()
    ns = set()
    for i in s:
        if check(i,v,a,b): ns.add(i)
    s = ns
0