結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー ayaoniayaoni
提出日時 2021-01-24 00:44:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 77,448 KB
最終ジャッジ日時 2023-08-30 11:19:35
合計ジャッジ時間 13,673 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,492 KB
testcase_01 AC 75 ms
71,348 KB
testcase_02 AC 73 ms
71,332 KB
testcase_03 AC 76 ms
71,260 KB
testcase_04 AC 78 ms
71,568 KB
testcase_05 AC 77 ms
71,324 KB
testcase_06 AC 79 ms
71,356 KB
testcase_07 AC 76 ms
71,140 KB
testcase_08 AC 75 ms
71,440 KB
testcase_09 AC 75 ms
71,480 KB
testcase_10 AC 76 ms
71,148 KB
testcase_11 AC 77 ms
71,284 KB
testcase_12 AC 79 ms
71,116 KB
testcase_13 AC 77 ms
71,524 KB
testcase_14 AC 85 ms
76,492 KB
testcase_15 AC 83 ms
76,308 KB
testcase_16 AC 77 ms
71,456 KB
testcase_17 AC 84 ms
76,528 KB
testcase_18 AC 75 ms
71,428 KB
testcase_19 AC 89 ms
76,580 KB
testcase_20 AC 84 ms
76,604 KB
testcase_21 AC 75 ms
71,296 KB
testcase_22 AC 91 ms
76,388 KB
testcase_23 AC 112 ms
76,964 KB
testcase_24 AC 135 ms
77,064 KB
testcase_25 AC 313 ms
76,972 KB
testcase_26 AC 100 ms
76,920 KB
testcase_27 AC 95 ms
76,736 KB
testcase_28 AC 308 ms
77,052 KB
testcase_29 AC 112 ms
77,448 KB
testcase_30 AC 113 ms
77,044 KB
testcase_31 AC 113 ms
77,252 KB
testcase_32 AC 99 ms
77,052 KB
testcase_33 AC 311 ms
77,000 KB
testcase_34 AC 304 ms
77,256 KB
testcase_35 AC 303 ms
77,080 KB
testcase_36 AC 307 ms
77,260 KB
testcase_37 AC 305 ms
77,252 KB
testcase_38 AC 311 ms
77,052 KB
testcase_39 AC 313 ms
77,100 KB
testcase_40 AC 309 ms
77,108 KB
testcase_41 AC 311 ms
77,064 KB
testcase_42 AC 308 ms
77,368 KB
testcase_43 AC 76 ms
71,264 KB
testcase_44 AC 300 ms
77,228 KB
testcase_45 AC 76 ms
71,140 KB
testcase_46 AC 311 ms
77,408 KB
権限があれば一括ダウンロードができます

ソースコード

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 = -1
oto = []
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