結果

問題 No.355 数当てゲーム(2)
ユーザー matsu7874matsu7874
提出日時 2016-04-01 23:17:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 1,183 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 11,008 KB
実行使用メモリ 25,236 KB
平均クエリ数 15.90
最終ジャッジ日時 2023-09-23 23:26:09
合計ジャッジ時間 4,290 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
24,540 KB
testcase_01 AC 34 ms
24,744 KB
testcase_02 AC 35 ms
24,684 KB
testcase_03 AC 36 ms
25,128 KB
testcase_04 AC 35 ms
24,968 KB
testcase_05 AC 36 ms
24,692 KB
testcase_06 AC 37 ms
24,444 KB
testcase_07 AC 35 ms
24,784 KB
testcase_08 AC 35 ms
24,856 KB
testcase_09 AC 35 ms
24,888 KB
testcase_10 AC 35 ms
24,564 KB
testcase_11 AC 38 ms
25,064 KB
testcase_12 AC 34 ms
24,512 KB
testcase_13 AC 37 ms
25,124 KB
testcase_14 AC 36 ms
25,156 KB
testcase_15 AC 36 ms
24,992 KB
testcase_16 AC 36 ms
24,652 KB
testcase_17 AC 35 ms
24,784 KB
testcase_18 AC 37 ms
24,420 KB
testcase_19 AC 36 ms
24,864 KB
testcase_20 AC 37 ms
25,056 KB
testcase_21 AC 35 ms
25,024 KB
testcase_22 AC 37 ms
24,476 KB
testcase_23 AC 36 ms
25,036 KB
testcase_24 AC 34 ms
24,468 KB
testcase_25 AC 39 ms
24,524 KB
testcase_26 AC 37 ms
24,820 KB
testcase_27 AC 37 ms
25,156 KB
testcase_28 AC 35 ms
24,964 KB
testcase_29 AC 35 ms
24,544 KB
testcase_30 AC 35 ms
24,824 KB
testcase_31 AC 35 ms
24,656 KB
testcase_32 AC 36 ms
24,472 KB
testcase_33 AC 34 ms
24,652 KB
testcase_34 AC 36 ms
24,620 KB
testcase_35 AC 34 ms
24,632 KB
testcase_36 AC 34 ms
24,828 KB
testcase_37 AC 34 ms
24,868 KB
testcase_38 AC 37 ms
25,236 KB
testcase_39 AC 35 ms
24,596 KB
testcase_40 AC 36 ms
24,760 KB
testcase_41 AC 36 ms
24,608 KB
testcase_42 AC 36 ms
24,608 KB
testcase_43 AC 35 ms
24,812 KB
testcase_44 AC 34 ms
24,680 KB
testcase_45 AC 34 ms
25,088 KB
testcase_46 AC 36 ms
25,056 KB
testcase_47 AC 35 ms
24,684 KB
testcase_48 AC 38 ms
25,140 KB
testcase_49 AC 35 ms
24,788 KB
testcase_50 AC 35 ms
24,564 KB
testcase_51 AC 36 ms
25,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import random
import itertools

popu = [[j for j in range(10)] for i in range(4)]
ans = []
his = []
a = [0, 1, 2, 3]
while True:
    print(*a)
    sys.stdout.flush()
    x, y = map(int, input().split())

    for i in range(4):
        for j in range(x):
            popu[i].append(a[i])
        for j in range(4):
            if j == i:
                continue
            for k in range(y):
                popu[j].append(a[i])

    if x == 4:
        exit()
    if x + y == 4:
        ans = a[:]
        break

    if x == 0:
        for i in range(4):
            while a[i] in popu[i]:
                popu[i].remove(a[i])
    if y == 0:
        for i in range(4):
            for j in range(4):
                if j == i:
                    continue
                while a[i] in popu[j]:
                    popu[j].remove(a[i])
    his.append(a[:])
    a = [random.choice(popu[i]) for i in range(4)]
    while any([a.count(i) > 1 for i in range(10)]) or a in his:
        a = [random.choice(popu[i]) for i in range(4)]


for a in itertools.permutations(ans):
    print(*a)
    sys.stdout.flush()
    x, y = map(int, input().split())
    if x == 4:
        exit()
0