結果

問題 No.2094 Symmetry
ユーザー titiatitia
提出日時 2022-10-07 22:24:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 10,888 KB
実行使用メモリ 27,540 KB
最終ジャッジ日時 2023-09-03 13:29:39
合計ジャッジ時間 9,546 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,816 KB
testcase_01 AC 16 ms
7,896 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 16 ms
7,832 KB
testcase_05 AC 17 ms
7,844 KB
testcase_06 AC 16 ms
7,752 KB
testcase_07 AC 16 ms
7,892 KB
testcase_08 AC 16 ms
7,824 KB
testcase_09 AC 300 ms
27,204 KB
testcase_10 AC 293 ms
26,880 KB
testcase_11 AC 311 ms
27,188 KB
testcase_12 AC 304 ms
27,036 KB
testcase_13 AC 301 ms
27,124 KB
testcase_14 AC 296 ms
26,952 KB
testcase_15 AC 309 ms
27,176 KB
testcase_16 AC 304 ms
27,028 KB
testcase_17 AC 300 ms
26,984 KB
testcase_18 AC 311 ms
27,024 KB
testcase_19 AC 307 ms
27,048 KB
testcase_20 AC 305 ms
26,976 KB
testcase_21 AC 305 ms
27,008 KB
testcase_22 AC 306 ms
27,096 KB
testcase_23 AC 299 ms
26,952 KB
testcase_24 AC 307 ms
26,996 KB
testcase_25 AC 304 ms
27,012 KB
testcase_26 AC 299 ms
27,160 KB
testcase_27 AC 15 ms
7,944 KB
testcase_28 AC 177 ms
26,516 KB
testcase_29 AC 16 ms
7,828 KB
testcase_30 AC 178 ms
26,432 KB
testcase_31 AC 200 ms
27,512 KB
testcase_32 AC 203 ms
27,540 KB
testcase_33 AC 15 ms
7,820 KB
testcase_34 AC 171 ms
23,456 KB
testcase_35 AC 178 ms
23,264 KB
testcase_36 AC 196 ms
26,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,K=map(int,input().split())
S=[input().strip() for i in range(2*N)]
C=[list(map(int,input().split())) for i in range(2*N)]

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

CX=[]
for c in C:
    CX+=c[:]

ANS1=sum(sorted(CX,reverse=True)[:b])

CY=[]

for i in range(2*N):
    for j in range(N):
        CY.append(C[i][j]+C[i][2*N-1-j])

ANS2=sum(sorted(CY,reverse=True)[:b//2])+K

if b%2==1:
    ANS2=-1<<100

print(max(ANS1,ANS2))
0