結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-01-22 21:44:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 77,252 KB
最終ジャッジ日時 2023-08-27 18:21:17
合計ジャッジ時間 14,015 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,144 KB
testcase_01 AC 73 ms
71,416 KB
testcase_02 AC 74 ms
71,084 KB
testcase_03 AC 75 ms
70,912 KB
testcase_04 AC 73 ms
71,260 KB
testcase_05 AC 76 ms
71,140 KB
testcase_06 AC 75 ms
71,200 KB
testcase_07 AC 75 ms
71,216 KB
testcase_08 AC 76 ms
71,396 KB
testcase_09 AC 76 ms
71,264 KB
testcase_10 AC 74 ms
71,336 KB
testcase_11 AC 76 ms
71,188 KB
testcase_12 AC 74 ms
71,048 KB
testcase_13 AC 74 ms
71,328 KB
testcase_14 AC 85 ms
75,896 KB
testcase_15 AC 84 ms
76,064 KB
testcase_16 AC 77 ms
71,336 KB
testcase_17 AC 84 ms
76,220 KB
testcase_18 AC 77 ms
71,328 KB
testcase_19 AC 89 ms
76,344 KB
testcase_20 AC 84 ms
76,244 KB
testcase_21 AC 76 ms
71,296 KB
testcase_22 AC 92 ms
76,536 KB
testcase_23 AC 111 ms
76,916 KB
testcase_24 AC 129 ms
76,740 KB
testcase_25 AC 300 ms
76,948 KB
testcase_26 AC 98 ms
76,464 KB
testcase_27 AC 92 ms
76,464 KB
testcase_28 AC 298 ms
77,028 KB
testcase_29 AC 107 ms
77,116 KB
testcase_30 AC 112 ms
76,960 KB
testcase_31 AC 110 ms
77,008 KB
testcase_32 AC 95 ms
76,384 KB
testcase_33 AC 298 ms
76,776 KB
testcase_34 AC 297 ms
76,952 KB
testcase_35 AC 300 ms
76,980 KB
testcase_36 AC 298 ms
76,952 KB
testcase_37 AC 300 ms
76,984 KB
testcase_38 AC 296 ms
77,036 KB
testcase_39 AC 297 ms
77,088 KB
testcase_40 AC 296 ms
76,880 KB
testcase_41 AC 298 ms
76,952 KB
testcase_42 AC 300 ms
77,084 KB
testcase_43 AC 75 ms
71,276 KB
testcase_44 AC 287 ms
77,252 KB
testcase_45 AC 76 ms
71,108 KB
testcase_46 AC 299 ms
77,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = [list(map(int, input().split())) for i in range(n)]
cur = -(10 ** 18)
for bit in range(1, 1 << n):
    l = []
    for i in range(n):
        if 1 << i & bit:
            l.append(i)
    leng = len(l)
    cnt = 0
    for i in l:
        cnt += a[i]
    for i in range(leng):
        for j in range(i + 1, leng):
            cnt += b[l[i]][l[j]]
    if cur < cnt:
        ans = l[:]
        cur = cnt
print(cur)
for i in range(len(ans)):
    ans[i] += 1
print(*ans)
0