結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー ああいいああいい
提出日時 2022-05-13 17:58:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 451 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 79,284 KB
最終ジャッジ日時 2023-09-29 01:32:46
合計ジャッジ時間 15,008 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,368 KB
testcase_01 AC 71 ms
71,288 KB
testcase_02 AC 70 ms
71,196 KB
testcase_03 AC 72 ms
71,476 KB
testcase_04 AC 76 ms
71,260 KB
testcase_05 AC 75 ms
71,436 KB
testcase_06 AC 70 ms
71,340 KB
testcase_07 AC 71 ms
71,264 KB
testcase_08 AC 71 ms
71,240 KB
testcase_09 AC 74 ms
71,332 KB
testcase_10 AC 73 ms
71,420 KB
testcase_11 AC 71 ms
71,480 KB
testcase_12 AC 70 ms
71,312 KB
testcase_13 AC 71 ms
71,480 KB
testcase_14 AC 86 ms
76,540 KB
testcase_15 AC 84 ms
76,328 KB
testcase_16 AC 77 ms
75,796 KB
testcase_17 AC 81 ms
76,532 KB
testcase_18 AC 72 ms
71,336 KB
testcase_19 AC 86 ms
76,600 KB
testcase_20 AC 82 ms
76,604 KB
testcase_21 AC 73 ms
71,556 KB
testcase_22 AC 85 ms
76,280 KB
testcase_23 AC 109 ms
76,968 KB
testcase_24 AC 131 ms
77,468 KB
testcase_25 AC 451 ms
79,096 KB
testcase_26 AC 88 ms
76,396 KB
testcase_27 AC 90 ms
76,576 KB
testcase_28 AC 446 ms
79,132 KB
testcase_29 AC 94 ms
76,380 KB
testcase_30 AC 112 ms
77,160 KB
testcase_31 AC 109 ms
76,972 KB
testcase_32 AC 88 ms
76,568 KB
testcase_33 AC 442 ms
79,136 KB
testcase_34 AC 443 ms
79,284 KB
testcase_35 AC 445 ms
79,128 KB
testcase_36 AC 443 ms
79,064 KB
testcase_37 AC 444 ms
79,012 KB
testcase_38 AC 443 ms
79,108 KB
testcase_39 AC 444 ms
79,172 KB
testcase_40 AC 443 ms
78,872 KB
testcase_41 AC 442 ms
79,136 KB
testcase_42 AC 442 ms
79,100 KB
testcase_43 AC 69 ms
71,200 KB
testcase_44 AC 443 ms
78,960 KB
testcase_45 AC 73 ms
71,288 KB
testcase_46 AC 444 ms
79,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = -1
S = -1
dp = [0] * (1 << N)
for bit in range(1,1 << N):
    tmp = 0
    for i in range(N):
        if (bit >> i) & 1:
            tmp += A[i]
            for j in range(i + 1,N):
                if (bit >> j) & 1:
                    tmp += B[i][j]
    if tmp > ans:
        ans = tmp
        S = bit
    #print(bit,tmp)
print(ans)
l = []
for i in range(N):
    if (S >> i) & 1:
        l.append(i + 1)
print(*l)
                    
0