結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー 👑 rin204rin204
提出日時 2021-08-23 06:06:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-04-24 21:12:02
合計ジャッジ時間 10,215 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,968 KB
testcase_01 AC 43 ms
51,968 KB
testcase_02 AC 42 ms
51,712 KB
testcase_03 AC 47 ms
51,968 KB
testcase_04 AC 42 ms
52,096 KB
testcase_05 AC 43 ms
51,712 KB
testcase_06 AC 43 ms
52,224 KB
testcase_07 AC 43 ms
52,224 KB
testcase_08 AC 44 ms
52,608 KB
testcase_09 AC 41 ms
51,712 KB
testcase_10 AC 43 ms
52,096 KB
testcase_11 AC 42 ms
51,968 KB
testcase_12 AC 41 ms
51,840 KB
testcase_13 AC 43 ms
51,968 KB
testcase_14 AC 56 ms
61,312 KB
testcase_15 AC 56 ms
61,184 KB
testcase_16 AC 44 ms
52,864 KB
testcase_17 AC 57 ms
61,312 KB
testcase_18 AC 43 ms
52,224 KB
testcase_19 AC 62 ms
63,744 KB
testcase_20 AC 57 ms
61,184 KB
testcase_21 AC 42 ms
51,968 KB
testcase_22 AC 60 ms
63,744 KB
testcase_23 AC 92 ms
76,032 KB
testcase_24 AC 115 ms
76,416 KB
testcase_25 AC 291 ms
76,160 KB
testcase_26 AC 69 ms
66,304 KB
testcase_27 AC 65 ms
65,024 KB
testcase_28 AC 292 ms
76,032 KB
testcase_29 AC 78 ms
71,168 KB
testcase_30 AC 90 ms
76,288 KB
testcase_31 AC 90 ms
76,160 KB
testcase_32 AC 72 ms
69,504 KB
testcase_33 AC 292 ms
75,904 KB
testcase_34 AC 290 ms
76,032 KB
testcase_35 AC 288 ms
75,904 KB
testcase_36 AC 291 ms
76,032 KB
testcase_37 AC 290 ms
76,032 KB
testcase_38 AC 290 ms
76,032 KB
testcase_39 AC 291 ms
76,416 KB
testcase_40 AC 291 ms
76,032 KB
testcase_41 AC 291 ms
75,904 KB
testcase_42 AC 292 ms
76,032 KB
testcase_43 AC 43 ms
51,968 KB
testcase_44 AC 283 ms
76,032 KB
testcase_45 AC 41 ms
52,096 KB
testcase_46 AC 289 ms
76,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = [list(map(int, input().split())) for _ in range(n)]
ans = -1
ind = -1
for bit in range(1, 1 << n):
    lst = []
    for i in range(n):
        if bit >> i & 1:
            lst.append(i)
    l = len(lst)
    tmp = 0
    for i in range(l):
        tmp += A[lst[i]]
        for j in range(i + 1, l):
            tmp += B[lst[i]][lst[j]]
    if tmp > ans:
        ans = tmp
        ind = lst
print(ans)
print(*[i + 1 for i in ind])
0