結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー hir355hir355
提出日時 2021-01-22 21:42:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 86,608 KB
実行使用メモリ 77,208 KB
最終ジャッジ日時 2023-08-27 18:16:14
合計ジャッジ時間 13,518 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,132 KB
testcase_01 AC 72 ms
71,256 KB
testcase_02 AC 74 ms
71,152 KB
testcase_03 AC 71 ms
70,836 KB
testcase_04 AC 75 ms
71,252 KB
testcase_05 AC 74 ms
70,996 KB
testcase_06 AC 74 ms
71,000 KB
testcase_07 AC 72 ms
70,956 KB
testcase_08 AC 73 ms
70,948 KB
testcase_09 AC 74 ms
71,196 KB
testcase_10 AC 73 ms
71,156 KB
testcase_11 AC 71 ms
70,876 KB
testcase_12 AC 70 ms
71,160 KB
testcase_13 AC 74 ms
71,204 KB
testcase_14 AC 90 ms
76,060 KB
testcase_15 AC 84 ms
76,340 KB
testcase_16 AC 74 ms
71,224 KB
testcase_17 AC 83 ms
76,012 KB
testcase_18 AC 72 ms
71,184 KB
testcase_19 AC 91 ms
75,976 KB
testcase_20 AC 83 ms
75,840 KB
testcase_21 AC 73 ms
71,016 KB
testcase_22 AC 87 ms
76,532 KB
testcase_23 AC 105 ms
76,892 KB
testcase_24 AC 129 ms
76,936 KB
testcase_25 AC 285 ms
76,992 KB
testcase_26 AC 94 ms
76,280 KB
testcase_27 AC 88 ms
76,476 KB
testcase_28 AC 284 ms
77,008 KB
testcase_29 AC 99 ms
76,324 KB
testcase_30 AC 106 ms
76,772 KB
testcase_31 AC 106 ms
76,824 KB
testcase_32 AC 97 ms
76,332 KB
testcase_33 AC 283 ms
77,208 KB
testcase_34 AC 281 ms
76,900 KB
testcase_35 AC 283 ms
76,944 KB
testcase_36 AC 282 ms
76,876 KB
testcase_37 AC 280 ms
76,880 KB
testcase_38 AC 283 ms
76,900 KB
testcase_39 AC 280 ms
76,936 KB
testcase_40 AC 284 ms
76,916 KB
testcase_41 AC 282 ms
76,932 KB
testcase_42 AC 287 ms
76,800 KB
testcase_43 AC 71 ms
71,072 KB
testcase_44 AC 274 ms
77,144 KB
testcase_45 AC 72 ms
70,796 KB
testcase_46 AC 283 ms
76,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = [list(map(int, input().split())) for _ in range(n)]
m = -10 ** 10
res = []
for i in range(1, 1 << n):
    t = []
    ans = 0
    for j in range(n):
        if(i >> j) & 1:
            t.append(j)
            ans += a[j]
    for j in range(len(t)):
        for k in range(j + 1, len(t)):
            ans += b[t[j]][t[k]]
    if m < ans:
        m = ans
        res = t[:]
print(m)
print(*(x + 1 for x in res))
0