結果
| 問題 |
No.519 アイドルユニット
|
| コンテスト | |
| ユーザー |
sue_charo
|
| 提出日時 | 2017-05-28 22:51:24 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,225 bytes |
| コンパイル時間 | 246 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 25,528 KB |
| 最終ジャッジ日時 | 2024-09-21 15:43:42 |
| 合計ジャッジ時間 | 4,660 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 33 |
ソースコード
# 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):
all_list = set()
for i in range(1, n + 1):
all_list.add(i)
all_used = set()
def find(set_used, set_left):
if len(set_left) == 0:
return 0
now_ret = -1
for i in itertools.combinations(list(set_left), 2):
next_set_used = copy.copy(set_used)
next_set_used.add(i[0])
next_set_used.add(i[1])
next_set_left = copy.copy(set_left)
next_set_left.remove(i[0])
next_set_left.remove(i[1])
now_ret = max(now_ret, find(next_set_used, next_set_left) + F[i[0] - 1][i[1] - 1])
return now_ret
ans = find(all_used, all_list)
return ans
def main():
params = read()
print(solve(*params))
if __name__ == "__main__":
main()
sue_charo