結果

問題 No.519 アイドルユニット
ユーザー hanorverhanorver
提出日時 2017-05-29 22:57:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 597 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 11,924 KB
実行使用メモリ 143,488 KB
最終ジャッジ日時 2023-10-21 17:00:03
合計ジャッジ時間 11,135 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 348 ms
43,792 KB
testcase_03 AC 58 ms
12,076 KB
testcase_04 AC 29 ms
10,148 KB
testcase_05 AC 28 ms
10,148 KB
testcase_06 AC 28 ms
10,148 KB
testcase_07 AC 29 ms
10,148 KB
testcase_08 AC 29 ms
10,180 KB
testcase_09 AC 32 ms
10,228 KB
testcase_10 AC 38 ms
10,492 KB
testcase_11 AC 57 ms
12,076 KB
testcase_12 AC 29 ms
10,148 KB
testcase_13 AC 55 ms
12,076 KB
testcase_14 AC 56 ms
12,076 KB
testcase_15 AC 56 ms
12,076 KB
testcase_16 AC 56 ms
12,076 KB
testcase_17 AC 57 ms
12,076 KB
testcase_18 AC 57 ms
12,076 KB
testcase_19 AC 56 ms
12,076 KB
testcase_20 AC 56 ms
12,076 KB
testcase_21 AC 57 ms
12,076 KB
testcase_22 AC 59 ms
12,076 KB
testcase_23 AC 56 ms
12,076 KB
testcase_24 AC 120 ms
18,208 KB
testcase_25 AC 122 ms
18,472 KB
testcase_26 AC 121 ms
18,472 KB
testcase_27 AC 121 ms
18,472 KB
testcase_28 AC 120 ms
18,472 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 30 ms
10,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def solve():
    n = int(input())
    A = [tuple(map(int, sys.stdin.readline().split())) for i in [0]*n]


    dp = [-1] * (1 << n)
    dp[0] = 0

    for i in range(1 << n):
        if dp[i] < 0:
            continue
        for j in range(n):
            if i & (1 << j):
                continue
            for k in range(j + 1, n):
                if i & (1 << k):
                    continue
                t = i | (1 << j) | (1 << k)
                if dp[t] < dp[i] + A[j][k]:
                    dp[t] = dp[i] + A[j][k]
            break

    return dp[-1]


print(solve())
0