結果

問題 No.519 アイドルユニット
コンテスト
ユーザー ああいい
提出日時 2022-03-08 16:52:42
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 457 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 241 ms
コンパイル使用メモリ 85,436 KB
実行使用メモリ 228,000 KB
最終ジャッジ日時 2026-04-03 15:17:35
合計ジャッジ時間 4,739 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
F = [list(map(int,input().split())) for _ in range(n)]
dp = [0] * (1 << n)

for bit in range(1 << n):
    if bin(bit).count('1') & 1:continue
    for i in range(n):
        if bit & (1 << i):continue
        b = bit | (1 <<i)
        for j in range(i+1,n):
            if bit & (1 << j):continue
            bj = b | (1 << j)
            if dp[bj] < dp[bit] + F[i][j]:
                dp[bj] = dp[bit] + F[i][j]
        break
print(dp[-1])
0