結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー paruf4paruf4
提出日時 2021-01-22 21:52:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 690 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 608 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 77,356 KB
最終ジャッジ日時 2023-08-27 18:40:46
合計ジャッジ時間 18,555 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,224 KB
testcase_01 AC 70 ms
71,348 KB
testcase_02 AC 69 ms
71,228 KB
testcase_03 AC 68 ms
71,084 KB
testcase_04 AC 70 ms
71,104 KB
testcase_05 AC 69 ms
71,208 KB
testcase_06 AC 70 ms
70,960 KB
testcase_07 AC 70 ms
71,352 KB
testcase_08 AC 71 ms
71,256 KB
testcase_09 AC 71 ms
71,072 KB
testcase_10 AC 67 ms
71,320 KB
testcase_11 AC 69 ms
71,248 KB
testcase_12 AC 70 ms
71,360 KB
testcase_13 AC 71 ms
71,268 KB
testcase_14 AC 79 ms
76,628 KB
testcase_15 AC 79 ms
76,728 KB
testcase_16 AC 69 ms
71,220 KB
testcase_17 AC 80 ms
76,672 KB
testcase_18 AC 70 ms
71,344 KB
testcase_19 AC 80 ms
76,672 KB
testcase_20 AC 79 ms
76,424 KB
testcase_21 AC 70 ms
71,272 KB
testcase_22 AC 80 ms
76,556 KB
testcase_23 AC 138 ms
77,000 KB
testcase_24 AC 218 ms
77,048 KB
testcase_25 AC 678 ms
76,980 KB
testcase_26 AC 88 ms
76,804 KB
testcase_27 AC 84 ms
76,640 KB
testcase_28 AC 684 ms
77,012 KB
testcase_29 AC 109 ms
77,132 KB
testcase_30 AC 139 ms
77,284 KB
testcase_31 AC 142 ms
77,144 KB
testcase_32 AC 100 ms
77,028 KB
testcase_33 AC 684 ms
77,220 KB
testcase_34 AC 690 ms
77,188 KB
testcase_35 AC 681 ms
77,356 KB
testcase_36 AC 683 ms
77,224 KB
testcase_37 AC 674 ms
77,204 KB
testcase_38 AC 687 ms
77,220 KB
testcase_39 AC 689 ms
77,124 KB
testcase_40 AC 689 ms
77,044 KB
testcase_41 AC 687 ms
77,188 KB
testcase_42 AC 683 ms
77,016 KB
testcase_43 AC 70 ms
71,164 KB
testcase_44 AC 674 ms
77,136 KB
testcase_45 AC 70 ms
71,212 KB
testcase_46 AC 678 ms
77,168 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)]
res = -10**18
r = []
for i in range(1 << n):
    s = []
    tmp = 0
    for j in range(n):
        if i & (1 << j):
            s.append(j)
            tmp += a[j]
    if len(s) == 0:
        continue
    if len(s) >= 2:
        for l in list(combinations(s, 2)):
            x = l[0]
            y = l[1]
            tmp += b[x][y]
    if tmp > res:
        res = tmp
        r = s
print(res)
for i in range(len(r)):
    r[i] = r[i]+1
print(*r)
0