結果

問題 No.2094 Symmetry
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-10-10 10:23:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 265 ms / 2,000 ms
コード長 730 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 121,740 KB
最終ジャッジ日時 2023-09-06 11:18:29
合計ジャッジ時間 10,280 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
72,728 KB
testcase_01 AC 108 ms
72,796 KB
testcase_02 AC 108 ms
72,672 KB
testcase_03 AC 108 ms
72,796 KB
testcase_04 AC 109 ms
72,776 KB
testcase_05 AC 108 ms
72,732 KB
testcase_06 AC 108 ms
72,656 KB
testcase_07 AC 109 ms
72,944 KB
testcase_08 AC 110 ms
72,732 KB
testcase_09 AC 261 ms
121,008 KB
testcase_10 AC 265 ms
120,748 KB
testcase_11 AC 263 ms
121,740 KB
testcase_12 AC 263 ms
121,488 KB
testcase_13 AC 233 ms
112,008 KB
testcase_14 AC 264 ms
121,328 KB
testcase_15 AC 264 ms
121,596 KB
testcase_16 AC 265 ms
120,956 KB
testcase_17 AC 231 ms
111,992 KB
testcase_18 AC 233 ms
111,628 KB
testcase_19 AC 261 ms
121,456 KB
testcase_20 AC 259 ms
121,676 KB
testcase_21 AC 260 ms
121,720 KB
testcase_22 AC 265 ms
120,616 KB
testcase_23 AC 231 ms
112,300 KB
testcase_24 AC 228 ms
112,304 KB
testcase_25 AC 265 ms
121,300 KB
testcase_26 AC 264 ms
121,332 KB
testcase_27 AC 107 ms
72,832 KB
testcase_28 AC 182 ms
110,884 KB
testcase_29 AC 106 ms
72,856 KB
testcase_30 AC 186 ms
110,904 KB
testcase_31 AC 202 ms
119,932 KB
testcase_32 AC 200 ms
119,848 KB
testcase_33 AC 112 ms
72,832 KB
testcase_34 AC 194 ms
119,464 KB
testcase_35 AC 195 ms
119,772 KB
testcase_36 AC 180 ms
113,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from itertools import *
from functools import *
import math,sys
input = sys.stdin.readline

N,K = map(int,input().split())
S = [list(input())[:-1] for _ in range(2*N)]
C = [list(map(int,input().split())) for _ in range(2*N)]
X = 0
for i in range(2*N):
    S[i] = [int(j=='#') for j in S[i]]
    X += sum(S[i])
ans = 0
Y = []
for i in range(2*N):
    for j in range(2*N):
        Y.append(C[i][j])
Y.sort()
ans = sum(Y[-X:])

if X%2==1:
    print(ans)
    exit()
if X==0:
    print(K)
    exit()
x = X//2
Y = []
for i in range(2*N):
    for j in range(N):
        Y.append(C[i][j]+C[i][-1-j])
Y.sort()
tmp = sum(Y[-x:])+K
print(max(ans,tmp))
0