結果

問題 No.355 数当てゲーム(2)
ユーザー matsu7874matsu7874
提出日時 2016-04-01 23:15:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 1,183 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 25,176 KB
平均クエリ数 17.54
最終ジャッジ日時 2023-09-23 23:25:34
合計ジャッジ時間 4,704 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
24,524 KB
testcase_01 AC 34 ms
25,096 KB
testcase_02 AC 35 ms
24,828 KB
testcase_03 AC 44 ms
25,076 KB
testcase_04 AC 36 ms
24,512 KB
testcase_05 AC 36 ms
24,488 KB
testcase_06 AC 35 ms
24,584 KB
testcase_07 AC 35 ms
25,012 KB
testcase_08 AC 36 ms
24,416 KB
testcase_09 AC 35 ms
24,396 KB
testcase_10 AC 35 ms
24,752 KB
testcase_11 AC 36 ms
24,764 KB
testcase_12 AC 35 ms
24,852 KB
testcase_13 AC 36 ms
24,324 KB
testcase_14 AC 34 ms
24,944 KB
testcase_15 AC 34 ms
24,628 KB
testcase_16 AC 36 ms
24,544 KB
testcase_17 AC 37 ms
25,000 KB
testcase_18 AC 37 ms
24,616 KB
testcase_19 AC 36 ms
24,480 KB
testcase_20 AC 36 ms
24,652 KB
testcase_21 AC 37 ms
24,632 KB
testcase_22 AC 36 ms
24,648 KB
testcase_23 AC 35 ms
24,276 KB
testcase_24 AC 35 ms
24,828 KB
testcase_25 AC 34 ms
25,112 KB
testcase_26 AC 35 ms
24,460 KB
testcase_27 AC 35 ms
24,756 KB
testcase_28 AC 35 ms
24,896 KB
testcase_29 AC 36 ms
24,748 KB
testcase_30 AC 36 ms
24,788 KB
testcase_31 AC 37 ms
25,176 KB
testcase_32 AC 34 ms
25,084 KB
testcase_33 AC 36 ms
24,940 KB
testcase_34 AC 34 ms
24,544 KB
testcase_35 AC 33 ms
24,580 KB
testcase_36 AC 35 ms
24,504 KB
testcase_37 AC 34 ms
25,076 KB
testcase_38 AC 35 ms
24,540 KB
testcase_39 AC 36 ms
24,808 KB
testcase_40 AC 35 ms
24,872 KB
testcase_41 AC 34 ms
24,676 KB
testcase_42 AC 35 ms
25,036 KB
testcase_43 AC 35 ms
24,608 KB
testcase_44 AC 35 ms
24,280 KB
testcase_45 AC 37 ms
24,520 KB
testcase_46 AC 35 ms
24,568 KB
testcase_47 AC 34 ms
24,660 KB
testcase_48 AC 37 ms
24,576 KB
testcase_49 AC 35 ms
24,480 KB
testcase_50 AC 35 ms
24,724 KB
testcase_51 AC 35 ms
24,504 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