結果

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

テストケース

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

ソースコード

diff #

import sys

def solve():
    n = int(sys.stdin.readline())
    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