結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー dangodango
提出日時 2023-06-25 21:26:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 475 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 77,248 KB
最終ジャッジ日時 2023-09-15 11:30:40
合計ジャッジ時間 15,484 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,200 KB
testcase_01 AC 72 ms
71,436 KB
testcase_02 AC 72 ms
71,228 KB
testcase_03 AC 72 ms
71,308 KB
testcase_04 AC 73 ms
71,200 KB
testcase_05 AC 72 ms
71,424 KB
testcase_06 AC 72 ms
71,368 KB
testcase_07 AC 72 ms
71,392 KB
testcase_08 AC 74 ms
71,404 KB
testcase_09 AC 72 ms
71,612 KB
testcase_10 AC 74 ms
71,540 KB
testcase_11 AC 72 ms
71,544 KB
testcase_12 AC 72 ms
71,116 KB
testcase_13 AC 72 ms
71,292 KB
testcase_14 AC 83 ms
76,444 KB
testcase_15 AC 82 ms
76,588 KB
testcase_16 AC 78 ms
75,444 KB
testcase_17 AC 82 ms
76,184 KB
testcase_18 AC 72 ms
71,308 KB
testcase_19 AC 85 ms
76,568 KB
testcase_20 AC 83 ms
76,432 KB
testcase_21 AC 72 ms
71,364 KB
testcase_22 AC 87 ms
76,568 KB
testcase_23 AC 120 ms
76,788 KB
testcase_24 AC 154 ms
76,984 KB
testcase_25 AC 475 ms
76,992 KB
testcase_26 AC 91 ms
76,624 KB
testcase_27 AC 96 ms
76,316 KB
testcase_28 AC 469 ms
77,060 KB
testcase_29 AC 104 ms
76,904 KB
testcase_30 AC 123 ms
76,708 KB
testcase_31 AC 122 ms
76,796 KB
testcase_32 AC 98 ms
76,984 KB
testcase_33 AC 467 ms
76,792 KB
testcase_34 AC 470 ms
76,976 KB
testcase_35 AC 466 ms
76,996 KB
testcase_36 AC 469 ms
77,036 KB
testcase_37 AC 469 ms
77,028 KB
testcase_38 AC 470 ms
76,784 KB
testcase_39 AC 469 ms
77,176 KB
testcase_40 AC 470 ms
77,060 KB
testcase_41 AC 468 ms
77,072 KB
testcase_42 AC 469 ms
77,056 KB
testcase_43 AC 72 ms
71,468 KB
testcase_44 AC 466 ms
77,248 KB
testcase_45 AC 75 ms
71,440 KB
testcase_46 AC 465 ms
77,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = []
    for _ in range(N):
        B.append(list(map(int, input().split())))
    W = float('-inf')
    res = []
    for i in range(1, 1 << N):
        num = 0
        bit = []
        for j, a in enumerate(A):
            if (i >> j) & 1:
                num += a
                bit.append(j + 1)

                for k in range(j + 1, N):
                    if (i >> k) & 1:
                        num += B[j][k]
        if W < num:
            W = num
            res = bit
    print(W)
    print(*res)
main()
0