結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー O2MTO2MT
提出日時 2021-01-23 17:28:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 431 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 77,632 KB
最終ジャッジ日時 2023-08-30 02:02:45
合計ジャッジ時間 15,093 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,840 KB
testcase_01 AC 72 ms
71,252 KB
testcase_02 AC 72 ms
71,116 KB
testcase_03 AC 71 ms
71,072 KB
testcase_04 AC 71 ms
71,060 KB
testcase_05 AC 71 ms
71,292 KB
testcase_06 AC 73 ms
71,300 KB
testcase_07 AC 73 ms
71,268 KB
testcase_08 AC 71 ms
71,312 KB
testcase_09 AC 71 ms
71,192 KB
testcase_10 AC 71 ms
71,156 KB
testcase_11 AC 72 ms
71,324 KB
testcase_12 AC 73 ms
71,108 KB
testcase_13 AC 73 ms
71,072 KB
testcase_14 AC 80 ms
76,112 KB
testcase_15 AC 82 ms
76,280 KB
testcase_16 AC 74 ms
70,836 KB
testcase_17 AC 82 ms
76,188 KB
testcase_18 AC 73 ms
71,112 KB
testcase_19 AC 87 ms
76,416 KB
testcase_20 AC 82 ms
76,216 KB
testcase_21 AC 71 ms
71,168 KB
testcase_22 AC 87 ms
76,920 KB
testcase_23 AC 123 ms
76,980 KB
testcase_24 AC 166 ms
77,484 KB
testcase_25 AC 428 ms
77,028 KB
testcase_26 AC 98 ms
76,648 KB
testcase_27 AC 94 ms
76,560 KB
testcase_28 AC 426 ms
77,260 KB
testcase_29 AC 112 ms
76,964 KB
testcase_30 AC 124 ms
77,316 KB
testcase_31 AC 123 ms
77,172 KB
testcase_32 AC 99 ms
77,424 KB
testcase_33 AC 429 ms
77,196 KB
testcase_34 AC 427 ms
77,144 KB
testcase_35 AC 425 ms
77,180 KB
testcase_36 AC 428 ms
77,188 KB
testcase_37 AC 427 ms
77,032 KB
testcase_38 AC 427 ms
77,584 KB
testcase_39 AC 428 ms
76,996 KB
testcase_40 AC 426 ms
77,512 KB
testcase_41 AC 426 ms
77,220 KB
testcase_42 AC 431 ms
77,072 KB
testcase_43 AC 72 ms
71,164 KB
testcase_44 AC 413 ms
77,256 KB
testcase_45 AC 72 ms
71,172 KB
testcase_46 AC 428 ms
77,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = [list(map(int,input().split())) for _ in range(N)]
ans_point = 0
ans_waon = [] 
for i in range(2**N):
    point = 0
    waon = []
    pattern = bin(i)[2:].zfill(N)
    for j in range(N):
        if pattern[j] == "1":
            point += A[j]
            waon.append(j+1)
    len_w = len(waon)
    for k in range(len_w):
        for l in range(k+1,len_w):
            point += B[waon[k]-1][waon[l]-1]
    if ans_point <= point:
        ans_point = point
        ans_waon = waon

print(ans_point)
print(*ans_waon)
0