結果

問題 No.1937 Various Tournament
ユーザー ああいいああいい
提出日時 2022-05-13 21:46:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 896 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 91,596 KB
最終ジャッジ日時 2023-09-29 06:54:57
合計ジャッジ時間 80,280 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,428 KB
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 AC 94 ms
76,764 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 90 ms
76,832 KB
testcase_09 TLE -
testcase_10 AC 93 ms
76,616 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 97 ms
76,596 KB
testcase_21 AC 74 ms
71,588 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 AC 94 ms
76,984 KB
testcase_26 TLE -
testcase_27 AC 72 ms
71,364 KB
testcase_28 TLE -
testcase_29 AC 97 ms
76,788 KB
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 AC 97 ms
76,780 KB
testcase_38 AC 93 ms
76,944 KB
testcase_39 TLE -
testcase_40 AC 96 ms
76,780 KB
testcase_41 AC 95 ms
77,016 KB
testcase_42 TLE -
testcase_43 AC 92 ms
76,556 KB
testcase_44 AC 73 ms
71,340 KB
testcase_45 TLE -
testcase_46 AC 97 ms
76,740 KB
testcase_47 AC 70 ms
71,364 KB
testcase_48 AC 70 ms
70,992 KB
testcase_49 AC 92 ms
76,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[0] * N for _ in range(1 << N)]
for i in range(N):
    for j in range(i + 1,N):
        bit = (1 << i) | (1 << j)
        if S[i][j]:
            dp[bit][i] = 2
        else:
            dp[bit][j] = 2
s = set([4,8,16])
for bit in range(1,1 << N):
    u = bin(bit).count('1')
    if u not in s:continue
    v = u // 2
    T = bit
    while T:
        T -= 1
        T &= bit
        if bin(T).count('1') != v:continue
        V = bit ^ T
        l = dp[T]
        ll = dp[V]
        for i in range(N):
            if (T >> i) & 1 == 0:continue
            for j in range(N):
                #if (V >> j) & 1 == 0:continue
                if S[i][j] == 1:
                    dp[bit][i] += l[i] * ll[j]
                else:
                    dp[bit][j] += l[i] * ll[j]
l = dp[-1]
for k in range(N):
    print(l[k])
0