結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー neterukunneterukun
提出日時 2021-01-22 21:32:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 502 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 76,976 KB
最終ジャッジ日時 2023-08-27 17:41:45
合計ジャッジ時間 15,963 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,336 KB
testcase_01 AC 69 ms
71,096 KB
testcase_02 AC 70 ms
71,112 KB
testcase_03 AC 69 ms
71,252 KB
testcase_04 AC 69 ms
71,432 KB
testcase_05 AC 69 ms
70,920 KB
testcase_06 AC 70 ms
71,324 KB
testcase_07 AC 70 ms
71,204 KB
testcase_08 AC 70 ms
70,924 KB
testcase_09 AC 68 ms
71,428 KB
testcase_10 AC 69 ms
71,164 KB
testcase_11 AC 69 ms
71,112 KB
testcase_12 AC 68 ms
71,320 KB
testcase_13 AC 72 ms
75,684 KB
testcase_14 AC 77 ms
76,392 KB
testcase_15 AC 78 ms
76,372 KB
testcase_16 AC 75 ms
76,212 KB
testcase_17 AC 77 ms
76,392 KB
testcase_18 AC 71 ms
75,648 KB
testcase_19 AC 78 ms
76,280 KB
testcase_20 AC 76 ms
76,452 KB
testcase_21 AC 71 ms
75,712 KB
testcase_22 AC 78 ms
76,484 KB
testcase_23 AC 118 ms
76,932 KB
testcase_24 AC 226 ms
76,740 KB
testcase_25 AC 487 ms
76,732 KB
testcase_26 AC 87 ms
76,280 KB
testcase_27 AC 82 ms
76,408 KB
testcase_28 AC 502 ms
76,580 KB
testcase_29 AC 95 ms
76,256 KB
testcase_30 AC 116 ms
76,828 KB
testcase_31 AC 118 ms
76,968 KB
testcase_32 AC 85 ms
76,308 KB
testcase_33 AC 493 ms
76,952 KB
testcase_34 AC 489 ms
76,584 KB
testcase_35 AC 472 ms
76,716 KB
testcase_36 AC 482 ms
76,976 KB
testcase_37 AC 483 ms
76,876 KB
testcase_38 AC 488 ms
76,756 KB
testcase_39 AC 482 ms
76,704 KB
testcase_40 AC 493 ms
76,848 KB
testcase_41 AC 472 ms
76,708 KB
testcase_42 AC 496 ms
76,848 KB
testcase_43 AC 70 ms
71,152 KB
testcase_44 AC 457 ms
76,720 KB
testcase_45 AC 66 ms
71,092 KB
testcase_46 AC 487 ms
76,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = [list(map(int, input().split())) for i in range(n)]


ans = 0
bit = 0
for bit_state in range(1 << n):
    score = 0
    tmp = 0
    for i in range(n):
        if (bit_state >> i) & 1:
            score += a[i]
            for j in range(n):
                if (bit_state >> j) & 1:
                    tmp += b[i][j]
    score += tmp // 2
    if score >= ans:
        ans = max(ans, score)
        bit = bit_state

res = []
for i in range(n):
    if (bit >> i) & 1:
        res.append(i + 1)
print(ans)
print(*res)
0