結果
| 問題 | No.355 数当てゲーム(2) | 
| コンテスト | |
| ユーザー |  matsu7874 | 
| 提出日時 | 2016-04-02 01:07:13 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 85 ms / 2,000 ms | 
| コード長 | 1,183 bytes | 
| コンパイル時間 | 398 ms | 
| コンパイル使用メモリ | 82,180 KB | 
| 実行使用メモリ | 73,456 KB | 
| 平均クエリ数 | 16.06 | 
| 最終ジャッジ日時 | 2024-07-16 23:24:05 | 
| 合計ジャッジ時間 | 7,359 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 52 | 
ソースコード
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()
            
            
            
        