結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー roarisroaris
提出日時 2021-01-23 18:17:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 77,468 KB
最終ジャッジ日時 2023-08-30 02:50:49
合計ジャッジ時間 13,108 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,148 KB
testcase_01 AC 74 ms
71,192 KB
testcase_02 AC 72 ms
71,372 KB
testcase_03 AC 70 ms
71,336 KB
testcase_04 AC 70 ms
71,172 KB
testcase_05 AC 71 ms
71,324 KB
testcase_06 AC 70 ms
71,632 KB
testcase_07 AC 71 ms
71,120 KB
testcase_08 AC 72 ms
71,256 KB
testcase_09 AC 71 ms
71,324 KB
testcase_10 AC 72 ms
71,444 KB
testcase_11 AC 70 ms
71,472 KB
testcase_12 AC 72 ms
71,384 KB
testcase_13 AC 71 ms
71,176 KB
testcase_14 AC 78 ms
76,256 KB
testcase_15 AC 80 ms
76,436 KB
testcase_16 AC 72 ms
71,376 KB
testcase_17 AC 78 ms
76,436 KB
testcase_18 AC 72 ms
71,380 KB
testcase_19 AC 84 ms
76,796 KB
testcase_20 AC 79 ms
76,408 KB
testcase_21 AC 71 ms
71,568 KB
testcase_22 AC 85 ms
76,620 KB
testcase_23 AC 105 ms
77,208 KB
testcase_24 AC 126 ms
77,244 KB
testcase_25 AC 278 ms
77,468 KB
testcase_26 AC 90 ms
76,644 KB
testcase_27 AC 86 ms
76,696 KB
testcase_28 AC 280 ms
77,084 KB
testcase_29 AC 98 ms
76,620 KB
testcase_30 AC 104 ms
77,272 KB
testcase_31 AC 102 ms
77,272 KB
testcase_32 AC 93 ms
76,716 KB
testcase_33 AC 281 ms
77,336 KB
testcase_34 AC 279 ms
77,316 KB
testcase_35 AC 279 ms
76,988 KB
testcase_36 AC 280 ms
77,276 KB
testcase_37 AC 280 ms
77,044 KB
testcase_38 AC 279 ms
77,240 KB
testcase_39 AC 280 ms
77,300 KB
testcase_40 AC 280 ms
77,336 KB
testcase_41 AC 279 ms
77,232 KB
testcase_42 AC 280 ms
76,984 KB
testcase_43 AC 71 ms
71,244 KB
testcase_44 AC 276 ms
77,228 KB
testcase_45 AC 74 ms
71,388 KB
testcase_46 AC 279 ms
77,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = [list(map(int, input().split())) for _ in range(N)]
M = -10**18

for S in range(1, 1<<N):
    l = []
    score = 0
    
    for i in range(N):
        if (S>>i)&1:
            l.append(i)
            score += A[i]
    
    for i in range(len(l)):
        for j in range(i+1, len(l)):
            score += B[l[i]][l[j]]
    
    if score>M:
        M = score
        ans = l

print(M)
print(*list(map(lambda x: x+1, ans)))
0