結果

問題 No.519 アイドルユニット
ユーザー sue_charosue_charo
提出日時 2017-06-02 12:32:36
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 296 ms / 1,000 ms
コード長 968 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 212,064 KB
最終ジャッジ日時 2023-07-26 17:09:58
合計ジャッジ時間 9,017 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 296 ms
211,940 KB
testcase_01 AC 296 ms
211,448 KB
testcase_02 AC 216 ms
113,352 KB
testcase_03 AC 180 ms
82,864 KB
testcase_04 AC 165 ms
79,516 KB
testcase_05 AC 165 ms
79,236 KB
testcase_06 AC 164 ms
79,124 KB
testcase_07 AC 166 ms
79,408 KB
testcase_08 AC 168 ms
79,772 KB
testcase_09 AC 178 ms
80,352 KB
testcase_10 AC 184 ms
81,304 KB
testcase_11 AC 182 ms
82,920 KB
testcase_12 AC 170 ms
79,536 KB
testcase_13 AC 180 ms
82,716 KB
testcase_14 AC 189 ms
82,776 KB
testcase_15 AC 187 ms
82,908 KB
testcase_16 AC 189 ms
82,548 KB
testcase_17 AC 187 ms
82,512 KB
testcase_18 AC 188 ms
82,788 KB
testcase_19 AC 191 ms
82,536 KB
testcase_20 AC 190 ms
82,912 KB
testcase_21 AC 189 ms
82,644 KB
testcase_22 AC 187 ms
82,908 KB
testcase_23 AC 189 ms
82,628 KB
testcase_24 AC 193 ms
88,972 KB
testcase_25 AC 191 ms
88,688 KB
testcase_26 AC 195 ms
88,752 KB
testcase_27 AC 192 ms
89,056 KB
testcase_28 AC 195 ms
88,912 KB
testcase_29 AC 293 ms
211,784 KB
testcase_30 AC 294 ms
212,064 KB
testcase_31 AC 290 ms
211,932 KB
testcase_32 AC 289 ms
211,856 KB
testcase_33 AC 165 ms
79,604 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