結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-22 21:32:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 77,136 KB
最終ジャッジ日時 2023-08-27 17:42:49
合計ジャッジ時間 14,831 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,092 KB
testcase_01 AC 69 ms
70,968 KB
testcase_02 AC 74 ms
71,144 KB
testcase_03 AC 69 ms
71,148 KB
testcase_04 AC 68 ms
71,252 KB
testcase_05 AC 70 ms
70,908 KB
testcase_06 AC 69 ms
71,096 KB
testcase_07 AC 69 ms
71,324 KB
testcase_08 AC 73 ms
71,248 KB
testcase_09 AC 69 ms
71,272 KB
testcase_10 AC 70 ms
71,328 KB
testcase_11 AC 71 ms
71,024 KB
testcase_12 AC 69 ms
71,084 KB
testcase_13 AC 72 ms
71,252 KB
testcase_14 AC 80 ms
76,368 KB
testcase_15 AC 82 ms
76,512 KB
testcase_16 AC 73 ms
75,716 KB
testcase_17 AC 81 ms
76,320 KB
testcase_18 AC 70 ms
71,024 KB
testcase_19 AC 89 ms
76,496 KB
testcase_20 AC 81 ms
76,436 KB
testcase_21 AC 70 ms
71,248 KB
testcase_22 AC 84 ms
76,432 KB
testcase_23 AC 113 ms
76,900 KB
testcase_24 AC 136 ms
76,936 KB
testcase_25 AC 438 ms
77,044 KB
testcase_26 AC 92 ms
76,352 KB
testcase_27 AC 86 ms
76,480 KB
testcase_28 AC 452 ms
76,744 KB
testcase_29 AC 99 ms
76,352 KB
testcase_30 AC 117 ms
77,108 KB
testcase_31 AC 113 ms
77,064 KB
testcase_32 AC 93 ms
76,356 KB
testcase_33 AC 455 ms
77,008 KB
testcase_34 AC 454 ms
77,012 KB
testcase_35 AC 455 ms
77,088 KB
testcase_36 AC 456 ms
77,004 KB
testcase_37 AC 459 ms
77,136 KB
testcase_38 AC 459 ms
76,900 KB
testcase_39 AC 446 ms
76,728 KB
testcase_40 AC 452 ms
77,012 KB
testcase_41 AC 447 ms
76,920 KB
testcase_42 AC 453 ms
77,132 KB
testcase_43 AC 70 ms
71,084 KB
testcase_44 AC 452 ms
77,004 KB
testcase_45 AC 70 ms
71,280 KB
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = list(map(int, input().split()))
B = tuple(tuple(map(int, input().split())) for _ in range(N))

ans = 0
pair = -1
for S in range(1, 1 << N):
    score = 0
    for i, a in enumerate(A):
        if (S >> i) & 1:
            score += a
    for i in range(N):
        if (S >> i) & 1:
            for j in range(i + 1, N):
                if (S >> j) & 1:
                    score += B[i][j]
    if score > ans:
        ans = score
        pair = S

print(ans)
print(*[i+1 for i in range(N) if (pair >> i) & 1])
0