結果

問題 No.1360 [Zelkova 4th Tune] 協和音
ユーザー U S
提出日時 2021-01-22 21:31:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 820 bytes
コンパイル時間 1,636 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 76,828 KB
最終ジャッジ日時 2024-12-27 21:48:27
合計ジャッジ時間 12,544 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 44 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys
# input = sys.stdin.readline
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))
import math
import bisect
from copy import deepcopy as dc
from itertools import accumulate
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1

n = int(input())
a = lmp()
grid = []
for i in range(n):
    b = lmp()
    grid.append(b)
ans = 0
ans_a = 0
for i in range(1,2**n):
    cnt = 0
    for j in range(n):
        if i & 1 << j:
            cnt += a[j]
            for k in range(j, n):
                if i & 1 << k:
                    cnt += grid[j][k]
    if ans < cnt:
        ans = cnt
        ans_a = i
print(ans)
ans_n = []
for i in range(n):
    if ans_a & 1 << i:
        ans_n.append(i+1)
print(*ans_n)



0