結果

問題 No.519 アイドルユニット
ユーザー sue_charosue_charo
提出日時 2017-06-02 12:32:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 206 ms / 1,000 ms
コード長 968 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 209,960 KB
最終ジャッジ日時 2024-04-14 06:44:10
合計ジャッジ時間 5,298 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 206 ms
209,416 KB
testcase_01 AC 204 ms
209,480 KB
testcase_02 AC 122 ms
111,116 KB
testcase_03 AC 82 ms
77,180 KB
testcase_04 AC 75 ms
68,916 KB
testcase_05 AC 73 ms
68,304 KB
testcase_06 AC 65 ms
67,820 KB
testcase_07 AC 68 ms
68,300 KB
testcase_08 AC 72 ms
70,204 KB
testcase_09 AC 79 ms
73,864 KB
testcase_10 AC 80 ms
76,264 KB
testcase_11 AC 81 ms
77,420 KB
testcase_12 AC 64 ms
67,884 KB
testcase_13 AC 82 ms
76,048 KB
testcase_14 AC 85 ms
76,448 KB
testcase_15 AC 85 ms
76,728 KB
testcase_16 AC 82 ms
76,940 KB
testcase_17 AC 82 ms
76,320 KB
testcase_18 AC 82 ms
76,320 KB
testcase_19 AC 85 ms
76,672 KB
testcase_20 AC 81 ms
77,752 KB
testcase_21 AC 81 ms
76,448 KB
testcase_22 AC 82 ms
76,576 KB
testcase_23 AC 81 ms
76,800 KB
testcase_24 AC 89 ms
83,360 KB
testcase_25 AC 87 ms
83,636 KB
testcase_26 AC 90 ms
84,208 KB
testcase_27 AC 90 ms
83,616 KB
testcase_28 AC 89 ms
83,768 KB
testcase_29 AC 204 ms
209,764 KB
testcase_30 AC 206 ms
209,536 KB
testcase_31 AC 206 ms
209,960 KB
testcase_32 AC 205 ms
209,472 KB
testcase_33 AC 65 ms
68,676 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