結果

問題 No.2094 Symmetry
ユーザー ntudantuda
提出日時 2022-10-08 14:06:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 109,760 KB
最終ジャッジ日時 2023-09-04 18:54:54
合計ジャッジ時間 9,056 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,268 KB
testcase_01 AC 68 ms
71,292 KB
testcase_02 AC 69 ms
71,372 KB
testcase_03 AC 70 ms
71,172 KB
testcase_04 AC 72 ms
71,120 KB
testcase_05 AC 73 ms
71,268 KB
testcase_06 AC 70 ms
71,272 KB
testcase_07 AC 70 ms
71,248 KB
testcase_08 AC 70 ms
71,376 KB
testcase_09 AC 218 ms
109,044 KB
testcase_10 AC 216 ms
108,692 KB
testcase_11 AC 219 ms
109,760 KB
testcase_12 AC 220 ms
109,440 KB
testcase_13 AC 219 ms
109,144 KB
testcase_14 AC 222 ms
109,304 KB
testcase_15 AC 219 ms
109,456 KB
testcase_16 AC 216 ms
109,508 KB
testcase_17 AC 217 ms
109,196 KB
testcase_18 AC 219 ms
108,336 KB
testcase_19 AC 216 ms
109,608 KB
testcase_20 AC 219 ms
109,640 KB
testcase_21 AC 219 ms
109,680 KB
testcase_22 AC 219 ms
108,476 KB
testcase_23 AC 218 ms
109,216 KB
testcase_24 AC 216 ms
109,412 KB
testcase_25 AC 216 ms
109,300 KB
testcase_26 AC 214 ms
109,116 KB
testcase_27 AC 75 ms
71,300 KB
testcase_28 AC 140 ms
104,976 KB
testcase_29 AC 70 ms
71,172 KB
testcase_30 AC 142 ms
104,916 KB
testcase_31 AC 143 ms
107,972 KB
testcase_32 AC 148 ms
107,804 KB
testcase_33 AC 73 ms
71,188 KB
testcase_34 AC 149 ms
106,396 KB
testcase_35 AC 149 ms
107,104 KB
testcase_36 AC 152 ms
107,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
N2 = 2 * N
S = [input() for _ in range(N2)]
C = [list(map(int, input().split())) for _ in range(N2)]
AS1 = []
AS2 = []

cnt = 0
for i in range(N2):
    for j in range(N):
        c1 = C[i][j]
        c2 = C[i][N2 - j - 1]
        AS1.append(c1)
        AS1.append(c2)
        AS2.append(c1 + c2)
        if S[i][j] == "#":
            cnt += 1
        if S[i][N2 - j - 1] == "#":
            cnt += 1

AS1.sort(reverse=True)
AS2.sort(reverse=True)
ans = sum(AS1[:cnt])
if cnt & 1 == 0:
    ans = max(ans, sum(AS2[:(cnt // 2)]) + K)
print(ans)
0