結果

問題 No.1937 Various Tournament
ユーザー titiatitia
提出日時 2022-05-18 03:41:57
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,182 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 81,912 KB
最終ジャッジ日時 2023-10-14 07:48:56
合計ジャッジ時間 11,434 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
77,808 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 AC 118 ms
77,688 KB
testcase_48 RE -
testcase_49 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N=int(input())
S=[list(map(int,input().split())) for i in range(N)]

ANS=[0]*N

def listbit(x):
    for i in range(1<<x):
        count=0
        for j in range(x):
            if i & (1<<j) != 0:
                count+=1
        if count==x//2 and i & (1<<0)==0:
            yield i

LBIT=[-1]*20

LBIT[2]=list(listbit(2))
LBIT[4]=list(listbit(4))
LBIT[8]=list(listbit(8))
LBIT[16]=list(listbit(16))

def calc(X,f):
    if len(X)==2:
        a,b=X[0],X[1]

        DX=Counter()

        if S[a][b]==1:
            DX[a]=f
        else:
            DX[b]=f
        return DX
        
    DD=Counter()

    for i in LBIT[len(X)]:
        Y=[]
        Z=[]

        for j in range(len(X)):
            if i & (1<<j) == 0:
                Y.append(X[j])
            else:
                Z.append(X[j])

        if len(Y)==len(X)//2:
            D1=calc(Y,f)
            D2=calc(Z,f)

            for d1 in D1:
                for d2 in D2:
                    DD[win(d1,d2)]+=D1[d1]*D2[d2]

    return DD

D=calc(list(range(N)),1)

if N==2:
    k=2
elif N==4:
    k=4*2
elif N==8:
    k=16*8
else:
    k=16*16*128

for i in range(N):
    print(D[i]*k)
0