結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー mkawa2mkawa2
提出日時 2021-01-22 23:42:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,166 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 81,076 KB
最終ジャッジ日時 2023-08-27 23:23:32
合計ジャッジ時間 12,483 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,400 KB
testcase_01 AC 69 ms
71,320 KB
testcase_02 AC 69 ms
71,396 KB
testcase_03 AC 70 ms
71,372 KB
testcase_04 AC 70 ms
71,208 KB
testcase_05 AC 69 ms
71,324 KB
testcase_06 AC 68 ms
71,484 KB
testcase_07 AC 69 ms
71,468 KB
testcase_08 AC 69 ms
71,404 KB
testcase_09 AC 70 ms
71,396 KB
testcase_10 AC 69 ms
71,432 KB
testcase_11 AC 67 ms
71,184 KB
testcase_12 AC 68 ms
71,628 KB
testcase_13 AC 69 ms
71,336 KB
testcase_14 AC 77 ms
76,324 KB
testcase_15 AC 75 ms
76,228 KB
testcase_16 AC 68 ms
71,184 KB
testcase_17 AC 74 ms
76,192 KB
testcase_18 AC 69 ms
71,468 KB
testcase_19 AC 82 ms
76,604 KB
testcase_20 AC 73 ms
76,332 KB
testcase_21 AC 68 ms
71,472 KB
testcase_22 AC 82 ms
76,456 KB
testcase_23 AC 130 ms
77,984 KB
testcase_24 AC 151 ms
78,728 KB
testcase_25 AC 279 ms
80,876 KB
testcase_26 AC 104 ms
77,868 KB
testcase_27 AC 104 ms
77,660 KB
testcase_28 AC 268 ms
80,956 KB
testcase_29 AC 117 ms
78,364 KB
testcase_30 AC 127 ms
78,880 KB
testcase_31 AC 130 ms
78,136 KB
testcase_32 AC 116 ms
77,988 KB
testcase_33 AC 268 ms
80,872 KB
testcase_34 AC 274 ms
80,872 KB
testcase_35 AC 266 ms
81,000 KB
testcase_36 AC 273 ms
80,924 KB
testcase_37 AC 274 ms
81,072 KB
testcase_38 AC 280 ms
80,908 KB
testcase_39 AC 280 ms
80,732 KB
testcase_40 AC 278 ms
80,876 KB
testcase_41 AC 271 ms
80,856 KB
testcase_42 AC 276 ms
81,076 KB
testcase_43 AC 71 ms
71,444 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

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
        cur = bb[i][j]
        s = bit
        while s < (1 << n):
            btos[s] += cur
            s = (s+1) | bit

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

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