結果

問題 No.2094 Symmetry
ユーザー roarisroaris
提出日時 2022-10-07 21:40:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 108,164 KB
最終ジャッジ日時 2023-09-03 00:56:36
合計ジャッジ時間 8,206 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,528 KB
testcase_01 AC 69 ms
71,192 KB
testcase_02 AC 69 ms
71,604 KB
testcase_03 AC 69 ms
71,432 KB
testcase_04 AC 70 ms
71,412 KB
testcase_05 AC 68 ms
71,188 KB
testcase_06 AC 70 ms
71,516 KB
testcase_07 AC 71 ms
71,400 KB
testcase_08 AC 71 ms
71,184 KB
testcase_09 AC 205 ms
103,792 KB
testcase_10 AC 205 ms
103,596 KB
testcase_11 AC 207 ms
104,420 KB
testcase_12 AC 210 ms
104,280 KB
testcase_13 AC 175 ms
94,824 KB
testcase_14 AC 207 ms
104,180 KB
testcase_15 AC 207 ms
103,936 KB
testcase_16 AC 207 ms
103,968 KB
testcase_17 AC 173 ms
94,828 KB
testcase_18 AC 175 ms
94,656 KB
testcase_19 AC 212 ms
104,156 KB
testcase_20 AC 206 ms
104,328 KB
testcase_21 AC 208 ms
104,312 KB
testcase_22 AC 204 ms
103,584 KB
testcase_23 AC 181 ms
95,088 KB
testcase_24 AC 182 ms
95,272 KB
testcase_25 AC 214 ms
103,912 KB
testcase_26 AC 215 ms
103,904 KB
testcase_27 AC 76 ms
71,600 KB
testcase_28 AC 143 ms
100,028 KB
testcase_29 AC 75 ms
71,632 KB
testcase_30 AC 145 ms
105,528 KB
testcase_31 AC 146 ms
103,048 KB
testcase_32 AC 149 ms
108,164 KB
testcase_33 AC 75 ms
71,484 KB
testcase_34 AC 142 ms
106,668 KB
testcase_35 AC 149 ms
107,032 KB
testcase_36 AC 133 ms
100,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, K = map(int, input().split())
S = [input()[:-1] for _ in range(2*N)]
C = [list(map(int, input().split())) for _ in range(2*N)]
b = 0

for i in range(2*N):
    for j in range(2*N):
        if S[i][j]=='#':
            b += 1

l = []

for i in range(2*N):
    for j in range(2*N):
        l.append(C[i][j])
    
l.sort(reverse=True)
ans = sum(l[:b])

if b%2==0:
    l = []
    
    for i in range(2*N):
        for j in range(N):
            l.append(C[i][j]+C[i][2*N-1-j])
    
    l.sort(reverse=True)
    ans = max(ans, sum(l[:b//2])+K)

print(ans)
0