結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー matriematrie
提出日時 2021-01-23 00:06:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 367 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 12,560 KB
最終ジャッジ日時 2023-08-28 09:06:08
合計ジャッジ時間 8,212 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,560 KB
testcase_01 AC 15 ms
8,172 KB
testcase_02 AC 14 ms
8,232 KB
testcase_03 AC 15 ms
8,140 KB
testcase_04 AC 15 ms
8,100 KB
testcase_05 AC 15 ms
8,112 KB
testcase_06 AC 16 ms
8,100 KB
testcase_07 AC 16 ms
8,164 KB
testcase_08 AC 16 ms
8,108 KB
testcase_09 AC 15 ms
8,144 KB
testcase_10 AC 16 ms
8,236 KB
testcase_11 AC 16 ms
8,184 KB
testcase_12 AC 16 ms
8,244 KB
testcase_13 AC 18 ms
8,144 KB
testcase_14 AC 88 ms
8,172 KB
testcase_15 AC 85 ms
8,188 KB
testcase_16 AC 30 ms
8,100 KB
testcase_17 AC 89 ms
8,284 KB
testcase_18 AC 18 ms
8,116 KB
testcase_19 AC 351 ms
8,152 KB
testcase_20 AC 87 ms
8,128 KB
testcase_21 AC 19 ms
8,176 KB
testcase_22 AC 358 ms
8,188 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as it
n=int(input())
A=list(map(int,input().split()))
B=[list(map(int,input().split())) for _ in range(n)]
S=list(range(1,n+1))+[0]*(n-1)
y=-10**18
for C in it.combinations(S,n):
	x=0
	for c in C:
		if c>0:x+=A[c-1]
	for i in range(n):
		for j in range(i):
			if i+1 in C and j+1 in C:x+=B[i][j]
	if x>y:y=x;Y=C
print(y)
print(*[i for i in Y if i>0])
0