結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー c-yanc-yan
提出日時 2021-01-22 21:37:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 77,352 KB
最終ジャッジ日時 2023-08-27 17:53:37
合計ジャッジ時間 16,606 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,444 KB
testcase_01 AC 73 ms
71,212 KB
testcase_02 AC 78 ms
71,388 KB
testcase_03 AC 74 ms
71,144 KB
testcase_04 AC 74 ms
71,440 KB
testcase_05 AC 75 ms
71,356 KB
testcase_06 AC 76 ms
71,140 KB
testcase_07 AC 77 ms
71,352 KB
testcase_08 AC 76 ms
71,360 KB
testcase_09 AC 73 ms
71,384 KB
testcase_10 AC 76 ms
71,364 KB
testcase_11 AC 76 ms
71,140 KB
testcase_12 AC 75 ms
71,140 KB
testcase_13 AC 75 ms
71,500 KB
testcase_14 AC 86 ms
76,528 KB
testcase_15 AC 87 ms
76,648 KB
testcase_16 AC 83 ms
76,564 KB
testcase_17 AC 86 ms
76,616 KB
testcase_18 AC 74 ms
71,312 KB
testcase_19 AC 89 ms
76,684 KB
testcase_20 AC 87 ms
76,536 KB
testcase_21 AC 75 ms
71,120 KB
testcase_22 AC 87 ms
76,660 KB
testcase_23 AC 150 ms
77,352 KB
testcase_24 AC 183 ms
77,100 KB
testcase_25 AC 529 ms
76,792 KB
testcase_26 AC 93 ms
76,348 KB
testcase_27 AC 91 ms
76,332 KB
testcase_28 AC 532 ms
76,800 KB
testcase_29 AC 109 ms
77,200 KB
testcase_30 AC 150 ms
77,256 KB
testcase_31 AC 151 ms
77,224 KB
testcase_32 AC 98 ms
76,348 KB
testcase_33 AC 533 ms
76,900 KB
testcase_34 AC 543 ms
76,796 KB
testcase_35 AC 527 ms
76,916 KB
testcase_36 AC 528 ms
77,072 KB
testcase_37 AC 527 ms
77,124 KB
testcase_38 AC 531 ms
77,080 KB
testcase_39 AC 528 ms
77,120 KB
testcase_40 AC 530 ms
77,120 KB
testcase_41 AC 528 ms
76,932 KB
testcase_42 AC 528 ms
77,208 KB
testcase_43 AC 75 ms
71,444 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)]

result = -(10 ** 18)
for t in product(range(2), repeat=N):
    v = 0
    for i in range(N):
        if t[i] == 1:
            v += A[i]
    for i in range(N):
        for j in range(i + 1, N):
            if t[i] & t[j] == 1:
                v += B[i][j]
    if v > result:
        result = v
        max_t = t
print(result)
print(*(i + 1 for i in range(N) if max_t[i] == 1))
0