結果

問題 No.519 アイドルユニット
ユーザー ああいいああいい
提出日時 2022-03-08 17:10:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 1,000 ms
コード長 549 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 207,492 KB
最終ジャッジ日時 2023-09-30 23:29:14
合計ジャッジ時間 6,256 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
207,352 KB
testcase_01 AC 217 ms
207,356 KB
testcase_02 AC 128 ms
109,028 KB
testcase_03 AC 86 ms
78,084 KB
testcase_04 AC 70 ms
71,188 KB
testcase_05 AC 68 ms
70,996 KB
testcase_06 AC 69 ms
71,032 KB
testcase_07 AC 69 ms
70,884 KB
testcase_08 AC 78 ms
75,972 KB
testcase_09 AC 87 ms
76,488 KB
testcase_10 AC 87 ms
76,648 KB
testcase_11 AC 90 ms
78,164 KB
testcase_12 AC 70 ms
71,300 KB
testcase_13 AC 88 ms
78,220 KB
testcase_14 AC 86 ms
78,156 KB
testcase_15 AC 86 ms
78,180 KB
testcase_16 AC 88 ms
78,220 KB
testcase_17 AC 86 ms
78,160 KB
testcase_18 AC 86 ms
78,080 KB
testcase_19 AC 86 ms
78,620 KB
testcase_20 AC 88 ms
78,572 KB
testcase_21 AC 87 ms
78,160 KB
testcase_22 AC 90 ms
78,304 KB
testcase_23 AC 85 ms
78,196 KB
testcase_24 AC 95 ms
84,364 KB
testcase_25 AC 93 ms
84,476 KB
testcase_26 AC 94 ms
84,444 KB
testcase_27 AC 95 ms
84,372 KB
testcase_28 AC 93 ms
84,756 KB
testcase_29 AC 199 ms
207,208 KB
testcase_30 AC 194 ms
207,108 KB
testcase_31 AC 191 ms
207,328 KB
testcase_32 AC 188 ms
207,492 KB
testcase_33 AC 68 ms
71,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
rr = sys.stdin

n = int(rr.readline())
F = [list(map(int,rr.readline().split())) for _ in range(n)]
dp = [-1] * (1 << n)
dp[0] = 0
for bit in range(1 << n):
    if dp[bit] < 0:continue
    for i in range(n):
        if bit >> i & 1:continue
        b = bit | (1 <<i)
        for j in range(i+1,n):
            if bit >> j & 1:continue
            bj = b | (1 << j)
            #if dp[bj] < dp[bit] + F[i][j]:
            #    dp[bj] = dp[bit] + F[i][j]
            dp[bj] = max(dp[bj],dp[bit] + F[i][j])
        break
print(dp[(1<<n)-1])
0