結果

問題 No.1937 Various Tournament
ユーザー titiatitia
提出日時 2022-05-18 03:42:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,479 ms / 2,000 ms
コード長 1,264 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 81,984 KB
最終ジャッジ日時 2023-10-14 07:51:54
合計ジャッジ時間 50,766 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
77,620 KB
testcase_01 AC 1,383 ms
81,492 KB
testcase_02 AC 1,439 ms
81,420 KB
testcase_03 AC 1,433 ms
81,580 KB
testcase_04 AC 1,457 ms
81,984 KB
testcase_05 AC 132 ms
78,148 KB
testcase_06 AC 1,445 ms
81,112 KB
testcase_07 AC 1,464 ms
81,764 KB
testcase_08 AC 133 ms
78,148 KB
testcase_09 AC 1,475 ms
80,704 KB
testcase_10 AC 133 ms
78,060 KB
testcase_11 AC 1,464 ms
80,984 KB
testcase_12 AC 1,472 ms
80,336 KB
testcase_13 AC 1,435 ms
80,892 KB
testcase_14 AC 1,446 ms
80,984 KB
testcase_15 AC 1,471 ms
81,196 KB
testcase_16 AC 1,461 ms
80,764 KB
testcase_17 AC 1,452 ms
81,244 KB
testcase_18 AC 1,462 ms
81,248 KB
testcase_19 AC 1,464 ms
81,056 KB
testcase_20 AC 130 ms
78,016 KB
testcase_21 AC 124 ms
77,816 KB
testcase_22 AC 1,428 ms
81,228 KB
testcase_23 AC 1,479 ms
81,336 KB
testcase_24 AC 1,419 ms
80,744 KB
testcase_25 AC 132 ms
78,116 KB
testcase_26 AC 1,440 ms
81,536 KB
testcase_27 AC 124 ms
77,756 KB
testcase_28 AC 1,434 ms
81,392 KB
testcase_29 AC 134 ms
78,068 KB
testcase_30 AC 1,449 ms
80,764 KB
testcase_31 AC 1,466 ms
80,640 KB
testcase_32 AC 1,442 ms
80,392 KB
testcase_33 AC 1,464 ms
80,804 KB
testcase_34 AC 1,437 ms
81,088 KB
testcase_35 AC 1,473 ms
81,112 KB
testcase_36 AC 1,439 ms
81,060 KB
testcase_37 AC 133 ms
78,184 KB
testcase_38 AC 133 ms
77,968 KB
testcase_39 AC 1,431 ms
80,992 KB
testcase_40 AC 131 ms
78,140 KB
testcase_41 AC 131 ms
78,252 KB
testcase_42 AC 1,454 ms
80,920 KB
testcase_43 AC 133 ms
78,176 KB
testcase_44 AC 122 ms
77,428 KB
testcase_45 AC 1,446 ms
81,008 KB
testcase_46 AC 133 ms
78,276 KB
testcase_47 AC 124 ms
77,464 KB
testcase_48 AC 125 ms
77,460 KB
testcase_49 AC 134 ms
78,208 KB
権限があれば一括ダウンロードができます

ソースコード

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 win(x,y):
    if S[x][y]==1:
        return x
    else:
        return y
    
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