結果
| 問題 |
No.519 アイドルユニット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-08 17:02:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 192 ms / 1,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 312 ms |
| コンパイル使用メモリ | 82,668 KB |
| 実行使用メモリ | 198,112 KB |
| 最終ジャッジ日時 | 2024-07-23 17:02:13 |
| 合計ジャッジ時間 | 4,739 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
n = int(input())
F = [list(map(int,input().split())) for _ in range(n)]
dp = [-1] * (1 << n)
dp[0] = 0
for bit in range(1 << n):
if dp[bit] < 0:continue
i = 0
while bit & (1 << i):i += 1
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]
print(dp[-1])