結果

問題 No.355 数当てゲーム(2)
ユーザー matsu7874matsu7874
提出日時 2016-04-02 01:07:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 1,183 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 88,832 KB
平均クエリ数 14.83
最終ジャッジ日時 2023-09-23 23:33:51
合計ジャッジ時間 8,272 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
87,664 KB
testcase_01 AC 97 ms
87,952 KB
testcase_02 AC 98 ms
88,456 KB
testcase_03 AC 96 ms
88,012 KB
testcase_04 AC 96 ms
88,168 KB
testcase_05 AC 98 ms
87,812 KB
testcase_06 AC 97 ms
87,668 KB
testcase_07 AC 97 ms
88,208 KB
testcase_08 AC 98 ms
87,676 KB
testcase_09 AC 97 ms
87,736 KB
testcase_10 AC 101 ms
88,300 KB
testcase_11 AC 100 ms
87,976 KB
testcase_12 AC 97 ms
87,952 KB
testcase_13 AC 97 ms
88,604 KB
testcase_14 AC 97 ms
87,888 KB
testcase_15 AC 97 ms
88,064 KB
testcase_16 AC 96 ms
88,832 KB
testcase_17 AC 97 ms
88,160 KB
testcase_18 AC 97 ms
87,992 KB
testcase_19 AC 97 ms
88,000 KB
testcase_20 AC 99 ms
87,772 KB
testcase_21 AC 100 ms
87,972 KB
testcase_22 AC 97 ms
88,272 KB
testcase_23 AC 97 ms
87,756 KB
testcase_24 AC 99 ms
88,100 KB
testcase_25 AC 99 ms
87,860 KB
testcase_26 AC 98 ms
87,816 KB
testcase_27 AC 97 ms
88,256 KB
testcase_28 AC 96 ms
87,536 KB
testcase_29 AC 99 ms
88,520 KB
testcase_30 AC 97 ms
87,912 KB
testcase_31 AC 99 ms
88,000 KB
testcase_32 AC 97 ms
87,796 KB
testcase_33 AC 98 ms
88,212 KB
testcase_34 AC 98 ms
87,800 KB
testcase_35 AC 98 ms
88,092 KB
testcase_36 AC 108 ms
87,448 KB
testcase_37 AC 103 ms
87,932 KB
testcase_38 AC 95 ms
87,648 KB
testcase_39 AC 97 ms
87,904 KB
testcase_40 AC 95 ms
87,824 KB
testcase_41 AC 97 ms
87,820 KB
testcase_42 AC 97 ms
87,800 KB
testcase_43 AC 107 ms
88,216 KB
testcase_44 AC 104 ms
87,684 KB
testcase_45 AC 96 ms
87,788 KB
testcase_46 AC 100 ms
87,972 KB
testcase_47 AC 98 ms
87,644 KB
testcase_48 AC 97 ms
87,760 KB
testcase_49 AC 98 ms
88,032 KB
testcase_50 AC 103 ms
88,368 KB
testcase_51 AC 99 ms
88,004 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