結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー ayaoniayaoni
提出日時 2021-01-24 00:43:23
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 846 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 79,528 KB
最終ジャッジ日時 2023-08-30 11:18:40
合計ジャッジ時間 16,249 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,344 KB
testcase_01 AC 75 ms
71,452 KB
testcase_02 AC 73 ms
71,368 KB
testcase_03 AC 74 ms
71,340 KB
testcase_04 AC 74 ms
71,152 KB
testcase_05 AC 74 ms
71,132 KB
testcase_06 AC 74 ms
71,292 KB
testcase_07 AC 76 ms
71,528 KB
testcase_08 AC 76 ms
71,348 KB
testcase_09 AC 74 ms
71,560 KB
testcase_10 AC 75 ms
71,476 KB
testcase_11 AC 75 ms
71,224 KB
testcase_12 AC 74 ms
71,356 KB
testcase_13 AC 74 ms
71,348 KB
testcase_14 AC 86 ms
76,376 KB
testcase_15 AC 86 ms
76,736 KB
testcase_16 AC 77 ms
71,228 KB
testcase_17 AC 84 ms
76,488 KB
testcase_18 AC 75 ms
71,424 KB
testcase_19 AC 92 ms
76,500 KB
testcase_20 AC 83 ms
76,304 KB
testcase_21 AC 75 ms
71,288 KB
testcase_22 AC 89 ms
76,568 KB
testcase_23 AC 112 ms
77,012 KB
testcase_24 AC 130 ms
76,968 KB
testcase_25 AC 309 ms
77,080 KB
testcase_26 AC 100 ms
76,480 KB
testcase_27 AC 93 ms
76,620 KB
testcase_28 AC 306 ms
77,020 KB
testcase_29 AC 104 ms
77,204 KB
testcase_30 AC 112 ms
77,416 KB
testcase_31 AC 112 ms
77,116 KB
testcase_32 AC 99 ms
77,132 KB
testcase_33 AC 310 ms
77,024 KB
testcase_34 AC 308 ms
77,088 KB
testcase_35 AC 304 ms
77,184 KB
testcase_36 AC 306 ms
77,168 KB
testcase_37 AC 305 ms
77,412 KB
testcase_38 AC 303 ms
77,088 KB
testcase_39 AC 305 ms
77,096 KB
testcase_40 AC 306 ms
77,048 KB
testcase_41 AC 308 ms
77,408 KB
testcase_42 AC 305 ms
77,100 KB
testcase_43 AC 74 ms
71,420 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
A = LI()
B = [LI() for _ in range(N)]

ans = 0
oto = 0
for i in range(1,1<<N):
    X = [j for j in range(N) if (i>>j) & 1]
    l = len(X)
    score = 0
    for x in X:
        score += A[x]
    for j in range(l-1):
        for k in range(j+1,l):
            score += B[X[j]][X[k]]
    if ans < score:
        ans = score
        oto = X

print(ans)
ANS = [x+1 for x in oto]
print(*ANS)
0