結果

問題 No.519 アイドルユニット
ユーザー sue_charosue_charo
提出日時 2017-06-02 12:32:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 968 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 12,112 KB
実行使用メモリ 146,296 KB
最終ジャッジ日時 2023-10-21 20:43:38
合計ジャッジ時間 11,553 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 409 ms
44,376 KB
testcase_03 AC 71 ms
12,924 KB
testcase_04 AC 36 ms
10,944 KB
testcase_05 AC 36 ms
10,944 KB
testcase_06 AC 36 ms
10,944 KB
testcase_07 AC 36 ms
10,944 KB
testcase_08 AC 38 ms
10,968 KB
testcase_09 AC 40 ms
10,956 KB
testcase_10 AC 48 ms
11,340 KB
testcase_11 AC 71 ms
12,924 KB
testcase_12 AC 35 ms
10,944 KB
testcase_13 AC 69 ms
12,924 KB
testcase_14 AC 71 ms
12,924 KB
testcase_15 AC 72 ms
12,924 KB
testcase_16 AC 70 ms
12,924 KB
testcase_17 AC 70 ms
12,924 KB
testcase_18 AC 70 ms
12,924 KB
testcase_19 AC 70 ms
12,924 KB
testcase_20 AC 71 ms
12,924 KB
testcase_21 AC 71 ms
12,924 KB
testcase_22 AC 71 ms
12,924 KB
testcase_23 AC 71 ms
12,924 KB
testcase_24 AC 145 ms
19,056 KB
testcase_25 AC 148 ms
19,320 KB
testcase_26 AC 149 ms
19,320 KB
testcase_27 AC 147 ms
19,320 KB
testcase_28 AC 147 ms
19,320 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 36 ms
10,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI(): return {key: value for key, value in ILI()}


def read():
    n = II()
    F = IAI(n)
    return (n, F)


def solve(n, F):
    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] + F[j][k])
            break

    return dp[-1]


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()
0