結果

問題 No.519 アイドルユニット
ユーザー しらっ亭しらっ亭
提出日時 2017-05-29 22:23:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 562 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 143,456 KB
最終ジャッジ日時 2023-10-21 16:58:32
合計ジャッジ時間 12,599 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 400 ms
43,728 KB
testcase_03 AC 62 ms
12,012 KB
testcase_04 AC 31 ms
10,084 KB
testcase_05 AC 29 ms
10,084 KB
testcase_06 AC 29 ms
10,084 KB
testcase_07 AC 29 ms
10,084 KB
testcase_08 AC 31 ms
10,120 KB
testcase_09 AC 32 ms
10,164 KB
testcase_10 AC 40 ms
10,428 KB
testcase_11 AC 65 ms
12,012 KB
testcase_12 AC 29 ms
10,084 KB
testcase_13 AC 62 ms
12,012 KB
testcase_14 AC 65 ms
12,012 KB
testcase_15 AC 63 ms
12,012 KB
testcase_16 AC 63 ms
12,012 KB
testcase_17 AC 61 ms
12,012 KB
testcase_18 AC 61 ms
12,012 KB
testcase_19 AC 62 ms
12,012 KB
testcase_20 AC 64 ms
12,012 KB
testcase_21 AC 63 ms
12,012 KB
testcase_22 AC 63 ms
12,012 KB
testcase_23 AC 63 ms
12,012 KB
testcase_24 AC 137 ms
18,144 KB
testcase_25 AC 138 ms
18,408 KB
testcase_26 AC 137 ms
18,408 KB
testcase_27 AC 136 ms
18,408 KB
testcase_28 AC 137 ms
18,408 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 29 ms
10,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n = int(input())
    A = []

    for i in range(n):
        A.append(list(map(int, input().split())))

    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)
                dp[t] = max(dp[t], dp[i] + A[j][k])
            break

    return dp[-1]


print(solve())
0