結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-01-22 21:45:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 86,616 KB
実行使用メモリ 79,256 KB
最終ジャッジ日時 2023-08-27 18:30:01
合計ジャッジ時間 11,600 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,320 KB
testcase_01 AC 74 ms
71,364 KB
testcase_02 AC 73 ms
71,076 KB
testcase_03 AC 74 ms
71,400 KB
testcase_04 AC 74 ms
71,180 KB
testcase_05 AC 74 ms
71,348 KB
testcase_06 AC 74 ms
71,392 KB
testcase_07 AC 74 ms
71,176 KB
testcase_08 AC 72 ms
71,276 KB
testcase_09 AC 73 ms
71,296 KB
testcase_10 AC 73 ms
71,316 KB
testcase_11 AC 73 ms
71,272 KB
testcase_12 AC 73 ms
71,440 KB
testcase_13 AC 74 ms
71,444 KB
testcase_14 AC 80 ms
76,500 KB
testcase_15 AC 80 ms
76,760 KB
testcase_16 AC 73 ms
71,468 KB
testcase_17 AC 81 ms
76,712 KB
testcase_18 AC 74 ms
71,260 KB
testcase_19 AC 84 ms
76,664 KB
testcase_20 AC 82 ms
76,200 KB
testcase_21 AC 74 ms
71,332 KB
testcase_22 AC 83 ms
76,564 KB
testcase_23 AC 92 ms
76,824 KB
testcase_24 AC 109 ms
76,884 KB
testcase_25 AC 171 ms
79,052 KB
testcase_26 AC 83 ms
76,464 KB
testcase_27 AC 84 ms
76,444 KB
testcase_28 AC 172 ms
79,068 KB
testcase_29 AC 87 ms
76,696 KB
testcase_30 AC 94 ms
76,956 KB
testcase_31 AC 93 ms
76,876 KB
testcase_32 AC 86 ms
76,544 KB
testcase_33 AC 173 ms
79,200 KB
testcase_34 AC 171 ms
79,048 KB
testcase_35 AC 170 ms
78,984 KB
testcase_36 AC 172 ms
79,000 KB
testcase_37 AC 172 ms
79,024 KB
testcase_38 AC 172 ms
79,008 KB
testcase_39 AC 173 ms
79,076 KB
testcase_40 AC 173 ms
78,864 KB
testcase_41 AC 172 ms
78,972 KB
testcase_42 AC 173 ms
79,080 KB
testcase_43 AC 74 ms
71,336 KB
testcase_44 AC 172 ms
79,096 KB
testcase_45 AC 76 ms
71,372 KB
testcase_46 AC 174 ms
79,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""

import sys
from sys import stdin

N = int(stdin.readline())
A = list(map(int,stdin.readline().split()))

B = [list(map(int,stdin.readline().split()))  for i in range(N)]

ans = [0] * (2**N)

for i in range(1,2**N):

    nl = i.bit_length()-1
    nb = 2**nl
    j = nb ^ i
    now = ans[j] + A[nl]

    for k in range(N):
        if j & (2**k) > 0:
            now += B[k][nl]

    ans[i] = now

maxind = 1
for i in range(1,2**N):
    if ans[maxind] < ans[i]:
        maxind = i
print (ans[maxind])
ANS = []
for i in range(N):
    if 2**i & maxind > 0:
        ANS.append(i+1)
print (*ANS)
0