結果

問題 No.2094 Symmetry
ユーザー aaaaaaaaaa2230
提出日時 2022-10-07 22:16:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 473 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 108,992 KB
最終ジャッジ日時 2024-06-12 19:00:17
合計ジャッジ時間 5,618 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
S = [input() for i in range(2*n)]
C = [list(map(int,input().split())) for i in range(2*n)]

num = 0
for s in S:
    num += s.count("#")

ans = -10**20

sC = []
for c in C:
    for i in c:
        sC.append(i)
sC.sort()
ans = max(ans,sum(sC[-num:]))

if num%2 == 0:
    sC = []
    for c in C:
        for i in range(n):
            cal = c[i]+c[-i-1]
            sC.append(cal)
    sC.sort()
    ans = max(ans,sum(sC[-num//2:])+k)
print(ans)
0