結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー zyxwzyxw
提出日時 2021-02-02 20:18:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 77,092 KB
最終ジャッジ日時 2023-09-12 11:22:32
合計ジャッジ時間 12,544 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,328 KB
testcase_01 AC 72 ms
71,148 KB
testcase_02 AC 76 ms
70,832 KB
testcase_03 AC 71 ms
71,100 KB
testcase_04 AC 71 ms
70,964 KB
testcase_05 AC 72 ms
71,136 KB
testcase_06 AC 70 ms
71,180 KB
testcase_07 AC 69 ms
71,044 KB
testcase_08 AC 71 ms
71,152 KB
testcase_09 AC 72 ms
71,100 KB
testcase_10 AC 71 ms
70,916 KB
testcase_11 AC 72 ms
71,244 KB
testcase_12 AC 72 ms
71,016 KB
testcase_13 AC 71 ms
71,156 KB
testcase_14 AC 80 ms
76,116 KB
testcase_15 AC 81 ms
76,532 KB
testcase_16 AC 73 ms
71,124 KB
testcase_17 AC 81 ms
76,336 KB
testcase_18 AC 71 ms
71,200 KB
testcase_19 AC 83 ms
76,348 KB
testcase_20 AC 81 ms
76,712 KB
testcase_21 AC 71 ms
71,228 KB
testcase_22 AC 84 ms
76,128 KB
testcase_23 AC 103 ms
76,736 KB
testcase_24 AC 130 ms
76,672 KB
testcase_25 AC 285 ms
76,836 KB
testcase_26 AC 88 ms
76,160 KB
testcase_27 AC 84 ms
76,260 KB
testcase_28 AC 283 ms
76,748 KB
testcase_29 AC 94 ms
76,376 KB
testcase_30 AC 103 ms
76,788 KB
testcase_31 AC 105 ms
76,592 KB
testcase_32 AC 91 ms
76,600 KB
testcase_33 AC 285 ms
76,624 KB
testcase_34 AC 284 ms
76,804 KB
testcase_35 AC 285 ms
77,092 KB
testcase_36 AC 287 ms
76,604 KB
testcase_37 AC 284 ms
76,840 KB
testcase_38 AC 285 ms
76,744 KB
testcase_39 AC 283 ms
76,784 KB
testcase_40 AC 282 ms
76,952 KB
testcase_41 AC 285 ms
77,000 KB
testcase_42 AC 281 ms
76,628 KB
testcase_43 AC 72 ms
70,868 KB
testcase_44 AC 303 ms
77,092 KB
testcase_45 AC 72 ms
71,128 KB
testcase_46 AC 283 ms
76,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=[list(map(int,input().split())) for i in range(N)]
ans=-10**20
ans_li=[]
for i in range(2**N):
    ans_pre=0
    ans_li_pre=[]
    for j in range(N):
        if (i>>j)&1:
            ans_li_pre.append(j+1)
            ans_pre+=A[j]
    for j in range(len(ans_li_pre)-1):
        for k in range(j+1,len(ans_li_pre)):
            ans_pre+=B[ans_li_pre[j]-1][ans_li_pre[k]-1]
    if ans_pre>=ans:
        ans=ans_pre
        ans_li=sorted(ans_li_pre)
print(ans)
print(*ans_li)
0