結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー mkawa2mkawa2
提出日時 2021-01-22 23:31:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,089 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-08-27 22:58:28
合計ジャッジ時間 7,586 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,280 KB
testcase_01 AC 15 ms
8,172 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 16 ms
8,124 KB
testcase_04 AC 17 ms
8,272 KB
testcase_05 AC 16 ms
8,128 KB
testcase_06 AC 16 ms
8,220 KB
testcase_07 AC 16 ms
8,304 KB
testcase_08 AC 16 ms
8,168 KB
testcase_09 AC 16 ms
8,192 KB
testcase_10 AC 16 ms
8,188 KB
testcase_11 AC 16 ms
8,232 KB
testcase_12 AC 16 ms
8,316 KB
testcase_13 AC 17 ms
8,132 KB
testcase_14 AC 26 ms
8,108 KB
testcase_15 AC 26 ms
8,224 KB
testcase_16 AC 18 ms
8,032 KB
testcase_17 AC 26 ms
8,092 KB
testcase_18 AC 17 ms
8,200 KB
testcase_19 AC 62 ms
8,116 KB
testcase_20 AC 26 ms
8,228 KB
testcase_21 AC 17 ms
8,184 KB
testcase_22 AC 57 ms
8,236 KB
testcase_23 TLE -
testcase_24 -- -
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