結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,472 KB
testcase_01 AC 72 ms
71,220 KB
testcase_02 AC 71 ms
71,368 KB
testcase_03 AC 74 ms
71,404 KB
testcase_04 AC 71 ms
71,052 KB
testcase_05 AC 72 ms
71,240 KB
testcase_06 AC 72 ms
71,400 KB
testcase_07 AC 74 ms
70,960 KB
testcase_08 AC 71 ms
71,376 KB
testcase_09 AC 71 ms
71,112 KB
testcase_10 AC 71 ms
71,472 KB
testcase_11 AC 69 ms
71,500 KB
testcase_12 AC 71 ms
71,320 KB
testcase_13 AC 71 ms
71,284 KB
testcase_14 AC 80 ms
76,228 KB
testcase_15 AC 80 ms
76,368 KB
testcase_16 AC 75 ms
71,160 KB
testcase_17 AC 82 ms
76,296 KB
testcase_18 AC 72 ms
71,516 KB
testcase_19 AC 85 ms
76,624 KB
testcase_20 AC 82 ms
76,368 KB
testcase_21 AC 74 ms
71,220 KB
testcase_22 AC 90 ms
76,552 KB
testcase_23 AC 106 ms
76,936 KB
testcase_24 AC 133 ms
76,764 KB
testcase_25 AC 301 ms
77,000 KB
testcase_26 AC 94 ms
76,520 KB
testcase_27 AC 91 ms
76,408 KB
testcase_28 AC 301 ms
76,972 KB
testcase_29 AC 99 ms
76,440 KB
testcase_30 AC 106 ms
76,848 KB
testcase_31 AC 105 ms
77,180 KB
testcase_32 AC 94 ms
76,408 KB
testcase_33 AC 304 ms
77,140 KB
testcase_34 AC 302 ms
76,916 KB
testcase_35 AC 302 ms
77,180 KB
testcase_36 AC 304 ms
76,884 KB
testcase_37 AC 306 ms
76,880 KB
testcase_38 AC 306 ms
76,636 KB
testcase_39 AC 307 ms
76,676 KB
testcase_40 AC 303 ms
76,984 KB
testcase_41 AC 305 ms
76,748 KB
testcase_42 AC 302 ms
76,928 KB
testcase_43 AC 72 ms
71,276 KB
testcase_44 AC 296 ms
77,188 KB
testcase_45 AC 71 ms
71,112 KB
testcase_46 AC 300 ms
77,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = [list(map(int, input().split())) for i in range(N)]
ans = -10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
bestids = []
for S in range(1, 1 << N):
    ids = []
    for i in range(N):
        if S >> i & 1:
            ids.append(i)
    point = 0
    for i in range(len(ids)):
        point += A[ids[i]]
        for j in range(i + 1, len(ids)):
            point += B[ids[i]][ids[j]]
    if point > ans:
        ans = point
        bestids = ids
print(ans)
print(*map(lambda x: x + 1, bestids))
0