結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー GER_chenGER_chen
提出日時 2021-01-22 21:48:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 77,144 KB
最終ジャッジ日時 2023-08-27 18:34:59
合計ジャッジ時間 12,768 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,068 KB
testcase_01 AC 73 ms
71,128 KB
testcase_02 AC 73 ms
70,948 KB
testcase_03 AC 73 ms
71,164 KB
testcase_04 AC 73 ms
71,216 KB
testcase_05 AC 73 ms
71,128 KB
testcase_06 AC 73 ms
71,060 KB
testcase_07 AC 72 ms
71,108 KB
testcase_08 AC 72 ms
71,340 KB
testcase_09 AC 73 ms
71,108 KB
testcase_10 AC 72 ms
71,292 KB
testcase_11 AC 73 ms
71,332 KB
testcase_12 AC 71 ms
71,332 KB
testcase_13 AC 71 ms
71,160 KB
testcase_14 AC 83 ms
76,500 KB
testcase_15 AC 83 ms
76,332 KB
testcase_16 AC 72 ms
71,132 KB
testcase_17 AC 82 ms
76,336 KB
testcase_18 AC 73 ms
71,272 KB
testcase_19 AC 85 ms
76,412 KB
testcase_20 AC 82 ms
76,400 KB
testcase_21 AC 71 ms
71,292 KB
testcase_22 AC 85 ms
76,360 KB
testcase_23 AC 104 ms
76,780 KB
testcase_24 AC 134 ms
76,760 KB
testcase_25 AC 280 ms
76,844 KB
testcase_26 AC 88 ms
76,356 KB
testcase_27 AC 87 ms
76,384 KB
testcase_28 AC 279 ms
76,952 KB
testcase_29 AC 95 ms
76,096 KB
testcase_30 AC 104 ms
76,808 KB
testcase_31 AC 104 ms
76,732 KB
testcase_32 AC 88 ms
76,436 KB
testcase_33 AC 279 ms
76,892 KB
testcase_34 AC 280 ms
76,824 KB
testcase_35 AC 278 ms
76,612 KB
testcase_36 AC 279 ms
76,780 KB
testcase_37 AC 278 ms
77,004 KB
testcase_38 AC 279 ms
76,900 KB
testcase_39 AC 282 ms
77,000 KB
testcase_40 AC 277 ms
76,948 KB
testcase_41 AC 278 ms
76,668 KB
testcase_42 AC 281 ms
76,680 KB
testcase_43 AC 71 ms
71,336 KB
testcase_44 AC 305 ms
77,144 KB
testcase_45 AC 73 ms
70,856 KB
testcase_46 AC 281 ms
76,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki-1360
N = int(input())
A = list(map(int, input().split()))
B = [list(map(int, input().split())) for _ in range(N)]
prepoint = 0
for i in range(1, 1<<N):
    on, point = [], 0
    for j in range(N):
        if (i>>j)&1:
            on.append(j)
            point += A[j]
    l = len(on)
    if l > 1:
        for x in range(l-1):
            for y in range(x+1, l):
                point += B[on[x]][on[y]]
    #print(i, point)
    if point >= prepoint:
        prepoint = point
        ans = [o+1 for o in on]
print(prepoint)
print(*ans)
0