結果

問題 No.1937 Various Tournament
ユーザー ああいいああいい
提出日時 2022-05-13 21:49:45
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,057 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 91,424 KB
最終ジャッジ日時 2023-09-29 07:00:32
合計ジャッジ時間 68,482 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,384 KB
testcase_01 TLE -
testcase_02 TLE -
testcase_03 TLE -
testcase_04 TLE -
testcase_05 AC 91 ms
76,816 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 91 ms
76,944 KB
testcase_09 TLE -
testcase_10 AC 88 ms
76,828 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 91 ms
76,800 KB
testcase_21 AC 69 ms
71,256 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 AC 92 ms
76,916 KB
testcase_26 TLE -
testcase_27 AC 71 ms
71,456 KB
testcase_28 TLE -
testcase_29 AC 90 ms
76,892 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 90 ms
76,896 KB
testcase_38 AC 92 ms
76,904 KB
testcase_39 TLE -
testcase_40 AC 90 ms
76,588 KB
testcase_41 AC 90 ms
76,988 KB
testcase_42 TLE -
testcase_43 AC 88 ms
76,900 KB
testcase_44 AC 71 ms
71,384 KB
testcase_45 TLE -
testcase_46 AC 89 ms
76,912 KB
testcase_47 AC 70 ms
71,440 KB
testcase_48 AC 72 ms
71,244 KB
testcase_49 AC 90 ms
76,984 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]:
            S[i][j] = i
            S[j][i] = i
        else:
            S[i][j] = j
            S[j][i] = j
        dp[bit][S[i][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]
                """
                dp[bit][S[i][j]] += l[i] * ll[j]
l = dp[-1]
for k in range(N):
    print(l[k])
0