結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー だれだれ
提出日時 2021-01-23 00:07:49
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 496 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 77,120 KB
最終ジャッジ日時 2023-08-28 09:07:56
合計ジャッジ時間 15,795 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,244 KB
testcase_01 AC 69 ms
71,304 KB
testcase_02 AC 72 ms
71,248 KB
testcase_03 AC 71 ms
71,276 KB
testcase_04 AC 70 ms
71,188 KB
testcase_05 AC 71 ms
70,888 KB
testcase_06 AC 71 ms
71,264 KB
testcase_07 AC 69 ms
71,080 KB
testcase_08 AC 71 ms
71,132 KB
testcase_09 AC 70 ms
71,160 KB
testcase_10 AC 70 ms
71,348 KB
testcase_11 AC 70 ms
71,244 KB
testcase_12 AC 71 ms
71,324 KB
testcase_13 AC 72 ms
71,312 KB
testcase_14 AC 84 ms
76,252 KB
testcase_15 AC 82 ms
76,436 KB
testcase_16 AC 79 ms
76,144 KB
testcase_17 AC 84 ms
76,292 KB
testcase_18 AC 71 ms
71,308 KB
testcase_19 AC 85 ms
76,240 KB
testcase_20 AC 85 ms
76,372 KB
testcase_21 AC 72 ms
71,040 KB
testcase_22 AC 84 ms
76,296 KB
testcase_23 AC 139 ms
76,400 KB
testcase_24 AC 170 ms
76,792 KB
testcase_25 AC 496 ms
76,788 KB
testcase_26 AC 86 ms
76,100 KB
testcase_27 AC 85 ms
76,280 KB
testcase_28 AC 489 ms
76,668 KB
testcase_29 AC 102 ms
76,516 KB
testcase_30 AC 138 ms
76,288 KB
testcase_31 AC 139 ms
76,284 KB
testcase_32 AC 90 ms
76,200 KB
testcase_33 AC 489 ms
76,688 KB
testcase_34 AC 494 ms
77,120 KB
testcase_35 AC 492 ms
76,824 KB
testcase_36 AC 490 ms
76,792 KB
testcase_37 AC 487 ms
76,792 KB
testcase_38 AC 489 ms
76,972 KB
testcase_39 AC 490 ms
76,788 KB
testcase_40 AC 495 ms
76,876 KB
testcase_41 AC 489 ms
76,832 KB
testcase_42 AC 490 ms
76,956 KB
testcase_43 AC 71 ms
71,144 KB
testcase_44 AC 487 ms
76,776 KB
testcase_45 AC 71 ms
71,256 KB
testcase_46 AC 490 ms
76,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(1 << n):
    t = 0
    for j in range(n):
        if i >> j & 1:
            t += a[j]
    for j in range(n-1):
        for k in range(j+1, n):
            if i>>j & 1 and i>>k & 1:
                t += b[j][k]
    if ans <= t:
        ans = t
        anss = i
print(ans)
u = []
for i in range(n):
    if anss >> i & 1:
        u.append(i+1)
if u:
    print(*u)
0