結果

問題 No.2094 Symmetry
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-10-01 10:57:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 608 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 108,112 KB
最終ジャッジ日時 2023-08-25 03:25:38
合計ジャッジ時間 10,250 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,332 KB
testcase_01 AC 69 ms
71,516 KB
testcase_02 AC 69 ms
71,308 KB
testcase_03 AC 70 ms
71,300 KB
testcase_04 AC 69 ms
71,304 KB
testcase_05 AC 68 ms
71,532 KB
testcase_06 AC 69 ms
71,220 KB
testcase_07 AC 68 ms
71,372 KB
testcase_08 AC 69 ms
71,508 KB
testcase_09 AC 216 ms
107,864 KB
testcase_10 AC 221 ms
107,432 KB
testcase_11 AC 217 ms
107,456 KB
testcase_12 AC 220 ms
107,624 KB
testcase_13 AC 186 ms
98,884 KB
testcase_14 AC 220 ms
107,836 KB
testcase_15 AC 217 ms
107,200 KB
testcase_16 AC 213 ms
107,792 KB
testcase_17 AC 183 ms
98,836 KB
testcase_18 AC 184 ms
98,168 KB
testcase_19 AC 219 ms
107,552 KB
testcase_20 AC 216 ms
107,712 KB
testcase_21 AC 219 ms
107,952 KB
testcase_22 AC 215 ms
107,068 KB
testcase_23 AC 187 ms
98,972 KB
testcase_24 AC 187 ms
99,060 KB
testcase_25 AC 220 ms
108,112 KB
testcase_26 AC 220 ms
107,572 KB
testcase_27 AC 73 ms
71,280 KB
testcase_28 AC 152 ms
104,576 KB
testcase_29 AC 70 ms
71,260 KB
testcase_30 AC 147 ms
99,776 KB
testcase_31 AC 150 ms
104,760 KB
testcase_32 AC 150 ms
97,396 KB
testcase_33 AC 68 ms
71,268 KB
testcase_34 AC 145 ms
105,724 KB
testcase_35 AC 145 ms
105,920 KB
testcase_36 AC 133 ms
98,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
cnt=0
for i in range(2*n):
    s=list(input())
    cnt+=s.count("#")
c=[[]]
for i in range(2*n):
    c.append([0]+list(map(int,input().split())))



#シンメトリーじゃない
x=[]
for i in range(1,2*n+1):
    for j in range(1,2*n+1):
        x.append(c[i][j])
x.sort(reverse=True)
res=0
for i in range(cnt):res+=x[i]
ans=res

#シンメトリー
if cnt%2==0:
    x=[]
    for i in range(1,2*n+1):
        for j in range(1,n+1):
            x.append(c[i][j]+c[i][2*n+1-j])
    x.sort(reverse=True)
    res=k
    for i in range(cnt//2):res+=x[i]
ans=max(ans,res)
print(ans)
0