結果

問題 No.2094 Symmetry
ユーザー lloyzlloyz
提出日時 2022-10-07 22:32:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 119,308 KB
最終ジャッジ日時 2023-09-03 13:48:35
合計ジャッジ時間 8,516 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,392 KB
testcase_01 AC 73 ms
71,136 KB
testcase_02 AC 72 ms
71,372 KB
testcase_03 AC 73 ms
71,216 KB
testcase_04 AC 73 ms
71,220 KB
testcase_05 AC 73 ms
71,352 KB
testcase_06 AC 73 ms
71,292 KB
testcase_07 AC 72 ms
71,288 KB
testcase_08 AC 72 ms
71,392 KB
testcase_09 AC 227 ms
118,196 KB
testcase_10 AC 227 ms
118,336 KB
testcase_11 AC 223 ms
118,992 KB
testcase_12 AC 223 ms
118,712 KB
testcase_13 AC 192 ms
109,308 KB
testcase_14 AC 225 ms
118,812 KB
testcase_15 AC 222 ms
118,572 KB
testcase_16 AC 223 ms
118,248 KB
testcase_17 AC 191 ms
109,428 KB
testcase_18 AC 194 ms
108,872 KB
testcase_19 AC 224 ms
118,784 KB
testcase_20 AC 226 ms
118,832 KB
testcase_21 AC 223 ms
119,308 KB
testcase_22 AC 219 ms
117,920 KB
testcase_23 AC 189 ms
109,208 KB
testcase_24 AC 191 ms
109,340 KB
testcase_25 AC 224 ms
118,632 KB
testcase_26 AC 230 ms
118,456 KB
testcase_27 AC 73 ms
71,416 KB
testcase_28 AC 154 ms
114,184 KB
testcase_29 AC 71 ms
71,376 KB
testcase_30 AC 151 ms
114,104 KB
testcase_31 AC 158 ms
117,248 KB
testcase_32 AC 153 ms
117,380 KB
testcase_33 AC 72 ms
71,504 KB
testcase_34 AC 151 ms
116,908 KB
testcase_35 AC 152 ms
109,952 KB
testcase_36 AC 141 ms
108,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

num = 0
L = []
for i in range(2 * n):
    for j in range(2 * n):
        L.append(C[i][j])
        if S[i][j] == '#':
            num += 1
L.sort(reverse=True)
ans = sum(L[:num])
if num % 2 == 0:
    LL = []
    for i in range(2 * n):
        for j in range(n):
            LL.append(C[i][j] + C[i][2 * n - j - 1])
    LL.sort(reverse=True)
    ans = max(ans, sum(LL[:num // 2]) + k)
print(ans)
0