結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー mkawa2mkawa2
提出日時 2021-01-22 23:32:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,089 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 82,668 KB
最終ジャッジ日時 2023-08-27 23:00:15
合計ジャッジ時間 10,774 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,664 KB
testcase_01 AC 72 ms
71,052 KB
testcase_02 AC 72 ms
71,172 KB
testcase_03 AC 71 ms
71,348 KB
testcase_04 AC 72 ms
71,052 KB
testcase_05 AC 71 ms
71,320 KB
testcase_06 AC 71 ms
71,112 KB
testcase_07 AC 70 ms
71,276 KB
testcase_08 AC 71 ms
71,288 KB
testcase_09 AC 70 ms
71,348 KB
testcase_10 AC 71 ms
71,252 KB
testcase_11 AC 73 ms
71,284 KB
testcase_12 AC 73 ms
71,224 KB
testcase_13 AC 78 ms
75,824 KB
testcase_14 AC 85 ms
76,476 KB
testcase_15 AC 87 ms
76,852 KB
testcase_16 AC 79 ms
75,812 KB
testcase_17 AC 84 ms
76,728 KB
testcase_18 AC 78 ms
75,524 KB
testcase_19 AC 96 ms
76,712 KB
testcase_20 AC 85 ms
76,776 KB
testcase_21 AC 78 ms
75,532 KB
testcase_22 AC 92 ms
76,764 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def MI1(): return map(int1, sys.stdin.buffer.readline().split())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
inf = 10**19
# md = 998244353
md = 10**9+7

n=II()
aa=LI()
bb=LLI(n)

btos=[0]*(1<<n)
for i in range(n):
    for j in range(i):
        bit=1<<i|1<<j
        btos[bit]=bb[i][j]

mx=-inf
ans=0
for bit in range(1<<n):
    cur=sum(aa[i] for i in range(n) if bit>>i&1)
    for mask,s in enumerate(btos):
        if bit&mask==mask:cur+=s
    if cur>mx:
        mx=cur
        ans=bit

print(mx)
print(" ".join(str(i+1) for i in range(n) if ans>>i&1))
0