結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー ygd.ygd.
提出日時 2021-06-16 23:30:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 734 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 77,064 KB
最終ジャッジ日時 2023-08-30 04:53:39
合計ジャッジ時間 18,444 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,016 KB
testcase_01 AC 75 ms
71,340 KB
testcase_02 AC 75 ms
71,148 KB
testcase_03 AC 76 ms
71,352 KB
testcase_04 AC 75 ms
71,184 KB
testcase_05 AC 76 ms
71,304 KB
testcase_06 AC 77 ms
71,304 KB
testcase_07 AC 77 ms
71,336 KB
testcase_08 AC 75 ms
71,304 KB
testcase_09 AC 76 ms
71,424 KB
testcase_10 AC 75 ms
71,208 KB
testcase_11 AC 76 ms
71,464 KB
testcase_12 AC 75 ms
71,024 KB
testcase_13 AC 75 ms
71,296 KB
testcase_14 AC 86 ms
76,324 KB
testcase_15 AC 87 ms
76,544 KB
testcase_16 AC 83 ms
76,200 KB
testcase_17 AC 88 ms
76,324 KB
testcase_18 AC 74 ms
71,384 KB
testcase_19 AC 87 ms
76,260 KB
testcase_20 AC 87 ms
76,164 KB
testcase_21 AC 78 ms
71,408 KB
testcase_22 AC 90 ms
76,456 KB
testcase_23 AC 156 ms
76,720 KB
testcase_24 AC 198 ms
76,588 KB
testcase_25 AC 605 ms
76,932 KB
testcase_26 AC 97 ms
76,208 KB
testcase_27 AC 92 ms
76,488 KB
testcase_28 AC 602 ms
76,584 KB
testcase_29 AC 115 ms
76,688 KB
testcase_30 AC 156 ms
76,744 KB
testcase_31 AC 154 ms
77,064 KB
testcase_32 AC 101 ms
76,920 KB
testcase_33 AC 605 ms
76,592 KB
testcase_34 AC 603 ms
76,592 KB
testcase_35 AC 599 ms
76,700 KB
testcase_36 AC 599 ms
76,576 KB
testcase_37 AC 604 ms
76,532 KB
testcase_38 AC 603 ms
76,748 KB
testcase_39 AC 605 ms
76,808 KB
testcase_40 AC 601 ms
76,276 KB
testcase_41 AC 603 ms
76,940 KB
testcase_42 AC 610 ms
76,592 KB
testcase_43 AC 75 ms
71,344 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import inf


def main():
    N = int(input()); INF = float("inf")
    A = list(map(int,input().split()))
    B = [list(map(int,input().split())) for _ in range(N)]

    mx = -INF
    idx = -1

    for i in range(1<<N):
        score = 0
        for j in range(N):
            if (i>>j)&1 == 1:
                score += A[j]
        for p in range(N):
            for q in range(p+1,N):
                if (i>>p)&1 == 1 and (i>>q)&1 == 1:
                    score += B[p][q]
        if score > mx:
            mx = score
            idx = i
    print(mx)
    ret = []
    for i in range(N):
        if (idx>>i)&1 == 1:
            ret.append(i+1) #1-index
    print(*ret)
    
        

if __name__ == '__main__':
    main()
0