結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー lloyzlloyz
提出日時 2022-04-11 00:36:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,340 KB
実行使用メモリ 77,296 KB
最終ジャッジ日時 2023-08-21 06:19:43
合計ジャッジ時間 11,669 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,504 KB
testcase_01 AC 71 ms
71,420 KB
testcase_02 AC 70 ms
71,676 KB
testcase_03 AC 70 ms
71,596 KB
testcase_04 AC 68 ms
71,632 KB
testcase_05 AC 71 ms
71,420 KB
testcase_06 AC 72 ms
71,604 KB
testcase_07 AC 68 ms
71,316 KB
testcase_08 AC 70 ms
71,484 KB
testcase_09 AC 71 ms
71,384 KB
testcase_10 AC 70 ms
71,212 KB
testcase_11 AC 70 ms
71,472 KB
testcase_12 AC 70 ms
71,272 KB
testcase_13 AC 72 ms
71,544 KB
testcase_14 AC 81 ms
76,492 KB
testcase_15 AC 79 ms
76,680 KB
testcase_16 AC 72 ms
71,220 KB
testcase_17 AC 79 ms
76,524 KB
testcase_18 AC 69 ms
71,364 KB
testcase_19 AC 78 ms
76,612 KB
testcase_20 AC 77 ms
76,452 KB
testcase_21 AC 71 ms
71,496 KB
testcase_22 AC 79 ms
76,488 KB
testcase_23 AC 99 ms
77,164 KB
testcase_24 AC 116 ms
77,188 KB
testcase_25 AC 231 ms
77,048 KB
testcase_26 AC 81 ms
76,504 KB
testcase_27 AC 82 ms
76,692 KB
testcase_28 AC 231 ms
77,188 KB
testcase_29 AC 89 ms
76,516 KB
testcase_30 AC 98 ms
77,076 KB
testcase_31 AC 97 ms
77,200 KB
testcase_32 AC 81 ms
76,520 KB
testcase_33 AC 229 ms
77,156 KB
testcase_34 AC 229 ms
77,108 KB
testcase_35 AC 230 ms
77,192 KB
testcase_36 AC 230 ms
77,200 KB
testcase_37 AC 229 ms
77,200 KB
testcase_38 AC 231 ms
77,184 KB
testcase_39 AC 228 ms
77,248 KB
testcase_40 AC 230 ms
77,196 KB
testcase_41 AC 230 ms
77,296 KB
testcase_42 AC 230 ms
77,100 KB
testcase_43 AC 68 ms
71,220 KB
testcase_44 AC 225 ms
77,172 KB
testcase_45 AC 67 ms
71,384 KB
testcase_46 AC 227 ms
76,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

n = int(input())
A = list(map(int, input().split()))
B = [list(map(int, input().split())) for _ in range(n)]

ans = -10**18
ANS = []
for r in range(1, n + 1):
    for C in combinations(range(1, n + 1), r):
        res = 0
        for i in range(r):
            res += A[C[i] - 1]
            for j in range(i + 1, r):
                res += B[C[i] - 1][C[j] - 1]
        if res > ans:
            ans = res
            ANS = C
print(ans)
print(*ANS)
0