結果
| 問題 |
No.2094 Symmetry
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-07 22:19:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 181 ms / 2,000 ms |
| コード長 | 589 bytes |
| コンパイル時間 | 340 ms |
| コンパイル使用メモリ | 82,300 KB |
| 実行使用メモリ | 107,316 KB |
| 最終ジャッジ日時 | 2024-06-12 19:07:20 |
| 合計ジャッジ時間 | 6,371 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
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(reverse=True)
count = 0
for i in range(num):
count += sC[i]
ans = max(ans,count)
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(reverse=True)
count = k
for i in range(num//2):
count += sC[i]
ans = max(ans,count)
print(ans)