結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー titiatitia
提出日時 2021-01-22 21:25:16
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 77,496 KB
最終ジャッジ日時 2023-08-27 17:14:04
合計ジャッジ時間 15,437 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,504 KB
testcase_01 AC 62 ms
71,368 KB
testcase_02 AC 61 ms
71,332 KB
testcase_03 AC 65 ms
71,432 KB
testcase_04 AC 63 ms
71,316 KB
testcase_05 AC 64 ms
71,404 KB
testcase_06 AC 63 ms
71,256 KB
testcase_07 AC 63 ms
71,284 KB
testcase_08 AC 61 ms
71,372 KB
testcase_09 AC 62 ms
71,124 KB
testcase_10 AC 66 ms
71,152 KB
testcase_11 AC 65 ms
71,464 KB
testcase_12 AC 64 ms
71,456 KB
testcase_13 AC 72 ms
71,156 KB
testcase_14 AC 76 ms
76,672 KB
testcase_15 AC 78 ms
76,624 KB
testcase_16 AC 72 ms
76,184 KB
testcase_17 AC 78 ms
76,444 KB
testcase_18 AC 66 ms
71,432 KB
testcase_19 AC 77 ms
76,668 KB
testcase_20 AC 79 ms
76,656 KB
testcase_21 AC 66 ms
71,164 KB
testcase_22 AC 79 ms
76,516 KB
testcase_23 AC 141 ms
77,400 KB
testcase_24 AC 167 ms
77,248 KB
testcase_25 AC 541 ms
77,220 KB
testcase_26 AC 83 ms
76,668 KB
testcase_27 AC 81 ms
76,516 KB
testcase_28 AC 528 ms
77,108 KB
testcase_29 AC 99 ms
77,104 KB
testcase_30 AC 146 ms
77,412 KB
testcase_31 AC 139 ms
77,352 KB
testcase_32 AC 89 ms
76,804 KB
testcase_33 AC 516 ms
76,908 KB
testcase_34 AC 512 ms
77,308 KB
testcase_35 AC 502 ms
77,132 KB
testcase_36 AC 510 ms
77,416 KB
testcase_37 AC 500 ms
76,876 KB
testcase_38 AC 516 ms
76,984 KB
testcase_39 AC 511 ms
77,144 KB
testcase_40 AC 518 ms
77,168 KB
testcase_41 AC 514 ms
76,904 KB
testcase_42 AC 501 ms
77,076 KB
testcase_43 AC 64 ms
71,596 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

ANS=0
ANSIND=[]

for i in range(1<<N):
    LIST=[0]*N
    S=0
    for j in range(N):
        if (1<<j) & i !=0:
            LIST[j]=1
            S+=A[j]

    for j in range(N):
        for k in range(j+1,N):
            if LIST[j]==1 and LIST[k]==1:
                S+=B[j][k]

    if ANS<S:
        ANS=S
        ANSIND=[i+1 for i in range(N) if LIST[i]==1]

print(ANS)

print(*ANSIND)
                
    
0