結果

問題 No.355 数当てゲーム(2)
ユーザー zombietan
提出日時 2016-06-06 14:16:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,019 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,608 KB
平均クエリ数 32.25
最終ジャッジ日時 2024-07-16 23:56:27
合計ジャッジ時間 5,935 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import combinations as comb
from itertools import permutations as perm
print('0 1 2 3')
sys.stdout.flush()
hit, blow = map(int, input().split())
a = hit + blow
if hit == 4:
    exit()
print('4 5 6 7')
sys.stdout.flush()
hit, blow = map(int, input().split())
b = hit + blow
if hit == 4:
    exit()
c = 4 - (a + b)
#count = 0
for x in comb([0,1,2,3],a):
    for y in comb([4,5,6,7],b):
        for z in comb([8,9],c):
            #count += 1
            num4 = sum([list(x),list(y),list(z)],[])
            print('{} {} {} {}'.format(*num4))
            sys.stdout.flush()
            hit, blow = map(int, input().split())
            if hit == 4:
                exit()
            if hit + blow == 4:
                align = num4
                break
        else:
            continue
        break
    else:
        continue
    break

for j in perm(align):
    print('{} {} {} {}'.format(*j))
    sys.stdout.flush()
    hit, blow = map(int, input().split())
    if hit == 4:
        exit()
0