結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-30 18:55:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 532 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 77,432 KB
最終ジャッジ日時 2023-09-02 01:45:55
合計ジャッジ時間 12,630 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,676 KB
testcase_01 AC 65 ms
71,560 KB
testcase_02 AC 66 ms
71,656 KB
testcase_03 AC 67 ms
71,524 KB
testcase_04 AC 67 ms
71,656 KB
testcase_05 AC 67 ms
71,368 KB
testcase_06 AC 68 ms
71,488 KB
testcase_07 AC 68 ms
71,692 KB
testcase_08 AC 66 ms
71,580 KB
testcase_09 AC 67 ms
71,228 KB
testcase_10 AC 68 ms
71,552 KB
testcase_11 AC 68 ms
71,540 KB
testcase_12 AC 67 ms
71,576 KB
testcase_13 AC 66 ms
71,224 KB
testcase_14 AC 73 ms
76,168 KB
testcase_15 AC 73 ms
76,464 KB
testcase_16 AC 65 ms
71,224 KB
testcase_17 AC 74 ms
76,528 KB
testcase_18 AC 66 ms
71,556 KB
testcase_19 AC 79 ms
76,428 KB
testcase_20 AC 75 ms
76,564 KB
testcase_21 AC 65 ms
71,556 KB
testcase_22 AC 78 ms
76,768 KB
testcase_23 AC 98 ms
77,220 KB
testcase_24 AC 135 ms
77,312 KB
testcase_25 AC 299 ms
77,148 KB
testcase_26 AC 83 ms
76,736 KB
testcase_27 AC 80 ms
76,836 KB
testcase_28 AC 306 ms
77,352 KB
testcase_29 AC 94 ms
77,316 KB
testcase_30 AC 99 ms
77,196 KB
testcase_31 AC 100 ms
77,252 KB
testcase_32 AC 83 ms
76,508 KB
testcase_33 AC 299 ms
77,432 KB
testcase_34 AC 301 ms
77,352 KB
testcase_35 AC 300 ms
77,160 KB
testcase_36 AC 300 ms
77,380 KB
testcase_37 AC 299 ms
77,396 KB
testcase_38 AC 300 ms
77,308 KB
testcase_39 AC 302 ms
77,184 KB
testcase_40 AC 300 ms
77,400 KB
testcase_41 AC 301 ms
77,400 KB
testcase_42 AC 302 ms
77,316 KB
testcase_43 AC 66 ms
71,488 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n=int(input())
a=list(map(int,input().split()))
b=[list(map(int,input().split())) for _ in range(n)]
ans=0
ans_l=[]
for bit in product(range(2),repeat=n):
    tmp=0
    ring=[]
    for i in range(n):
        if bit[i]:
            tmp+=a[i]
            ring.append(i+1)
    if len(ring)>=2:
        for i in range(len(ring)):
            for j in range(i+1,len(ring)):
                tmp+=b[ring[i]-1][ring[j]-1]
    if tmp>ans:
        ans=tmp
        ans_l=ring
ans_l.sort()
print(ans)
print(*ans_l)
0