結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー U SU S
提出日時 2021-01-22 22:21:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 470 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 86,676 KB
実行使用メモリ 77,088 KB
最終ジャッジ日時 2023-08-27 19:59:08
合計ジャッジ時間 15,798 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,276 KB
testcase_01 AC 76 ms
71,468 KB
testcase_02 AC 73 ms
71,212 KB
testcase_03 AC 72 ms
71,456 KB
testcase_04 AC 70 ms
71,416 KB
testcase_05 AC 71 ms
71,360 KB
testcase_06 AC 70 ms
71,408 KB
testcase_07 AC 71 ms
71,392 KB
testcase_08 AC 69 ms
71,336 KB
testcase_09 AC 71 ms
71,472 KB
testcase_10 AC 73 ms
71,124 KB
testcase_11 AC 70 ms
71,172 KB
testcase_12 AC 70 ms
71,288 KB
testcase_13 AC 71 ms
71,244 KB
testcase_14 AC 86 ms
76,536 KB
testcase_15 AC 80 ms
76,188 KB
testcase_16 AC 75 ms
75,636 KB
testcase_17 AC 81 ms
76,328 KB
testcase_18 AC 72 ms
71,044 KB
testcase_19 AC 79 ms
76,384 KB
testcase_20 AC 84 ms
76,556 KB
testcase_21 AC 69 ms
71,224 KB
testcase_22 AC 80 ms
76,320 KB
testcase_23 AC 105 ms
77,012 KB
testcase_24 AC 129 ms
76,844 KB
testcase_25 AC 470 ms
76,836 KB
testcase_26 AC 90 ms
76,572 KB
testcase_27 AC 90 ms
76,612 KB
testcase_28 AC 458 ms
77,076 KB
testcase_29 AC 94 ms
76,240 KB
testcase_30 AC 107 ms
76,728 KB
testcase_31 AC 107 ms
76,952 KB
testcase_32 AC 90 ms
76,584 KB
testcase_33 AC 462 ms
76,864 KB
testcase_34 AC 460 ms
77,088 KB
testcase_35 AC 464 ms
77,032 KB
testcase_36 AC 461 ms
76,928 KB
testcase_37 AC 466 ms
77,064 KB
testcase_38 AC 463 ms
77,020 KB
testcase_39 AC 459 ms
76,892 KB
testcase_40 AC 465 ms
77,016 KB
testcase_41 AC 462 ms
77,076 KB
testcase_42 AC 462 ms
76,872 KB
testcase_43 AC 70 ms
71,200 KB
testcase_44 AC 460 ms
77,012 KB
testcase_45 AC 72 ms
71,324 KB
testcase_46 AC 461 ms
77,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
grid = []
for i in range(n):
    b = list(map(int,input().split()))
    grid.append(b)
ans = 0
num = 0
for i in range(2**n):
    cnt = 0
    for j in range(n):
        if i & 1 << j:
            cnt += a[j]
            for k in range(j+1,n):
                if i & 1 << k:
                    cnt += grid[j][k]
    if ans <= cnt:
        ans = cnt
        num = i
print(ans)
u = []
for i in range(n):
    if num & 1 << i:
        u.append(i+1)
print(*u)

0