結果

問題 No.519 アイドルユニット
ユーザー vwxyzvwxyz
提出日時 2021-07-23 11:47:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 382 ms / 1,000 ms
コード長 998 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 104,180 KB
最終ジャッジ日時 2023-09-25 09:58:45
合計ジャッジ時間 12,896 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 370 ms
102,856 KB
testcase_01 AC 380 ms
104,172 KB
testcase_02 AC 306 ms
97,992 KB
testcase_03 AC 286 ms
95,532 KB
testcase_04 AC 242 ms
91,304 KB
testcase_05 AC 250 ms
91,324 KB
testcase_06 AC 246 ms
91,304 KB
testcase_07 AC 244 ms
91,176 KB
testcase_08 AC 259 ms
94,776 KB
testcase_09 AC 273 ms
95,132 KB
testcase_10 AC 281 ms
94,920 KB
testcase_11 AC 282 ms
95,352 KB
testcase_12 AC 245 ms
91,496 KB
testcase_13 AC 285 ms
95,356 KB
testcase_14 AC 288 ms
95,612 KB
testcase_15 AC 281 ms
95,144 KB
testcase_16 AC 294 ms
95,560 KB
testcase_17 AC 282 ms
95,416 KB
testcase_18 AC 281 ms
95,356 KB
testcase_19 AC 281 ms
95,444 KB
testcase_20 AC 283 ms
95,528 KB
testcase_21 AC 282 ms
95,532 KB
testcase_22 AC 287 ms
95,128 KB
testcase_23 AC 275 ms
94,636 KB
testcase_24 AC 287 ms
96,012 KB
testcase_25 AC 287 ms
96,484 KB
testcase_26 AC 294 ms
96,160 KB
testcase_27 AC 288 ms
96,184 KB
testcase_28 AC 293 ms
96,292 KB
testcase_29 AC 374 ms
103,384 KB
testcase_30 AC 369 ms
104,180 KB
testcase_31 AC 378 ms
103,520 KB
testcase_32 AC 382 ms
104,040 KB
testcase_33 AC 244 ms
91,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

N=int(readline())
F=[list(map(int,readline().split())) for i in range(N)]
@lru_cache(maxsize=None)
def main(bit):
    if bit==0:
        return 0
    lst=[i for i in range(N) if bit>>i&1]
    l=len(lst)
    m=0
    for i in range(1,l):
        m=max(m,main(bit^1<<lst[0]^1<<lst[i])+F[lst[0]][lst[i]])
    return m
ans=main((1<<N)-1)
print(ans)
0