結果

問題 No.2094 Symmetry
ユーザー ygd.ygd.
提出日時 2022-10-07 23:14:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,238 bytes
コンパイル時間 2,002 ms
コンパイル使用メモリ 86,632 KB
実行使用メモリ 111,240 KB
最終ジャッジ日時 2023-09-03 15:26:23
合計ジャッジ時間 11,971 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
72,604 KB
testcase_01 AC 111 ms
72,420 KB
testcase_02 AC 112 ms
72,340 KB
testcase_03 AC 112 ms
72,684 KB
testcase_04 WA -
testcase_05 AC 114 ms
72,408 KB
testcase_06 WA -
testcase_07 AC 112 ms
72,608 KB
testcase_08 AC 111 ms
72,632 KB
testcase_09 AC 270 ms
110,156 KB
testcase_10 AC 265 ms
109,772 KB
testcase_11 AC 264 ms
111,240 KB
testcase_12 AC 265 ms
110,468 KB
testcase_13 WA -
testcase_14 AC 265 ms
110,320 KB
testcase_15 AC 264 ms
110,296 KB
testcase_16 AC 264 ms
110,232 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 263 ms
110,396 KB
testcase_20 AC 265 ms
110,416 KB
testcase_21 AC 269 ms
110,752 KB
testcase_22 AC 265 ms
109,660 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 262 ms
110,280 KB
testcase_26 AC 262 ms
110,088 KB
testcase_27 AC 114 ms
72,824 KB
testcase_28 AC 192 ms
106,168 KB
testcase_29 AC 111 ms
72,684 KB
testcase_30 AC 192 ms
105,992 KB
testcase_31 AC 194 ms
108,896 KB
testcase_32 AC 196 ms
109,032 KB
testcase_33 AC 112 ms
72,536 KB
testcase_34 AC 190 ms
105,204 KB
testcase_35 AC 191 ms
107,648 KB
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
import math
import bisect
#import itertools
#import random
from heapq import heapify, heappop, heappush
from collections import defaultdict 
#from collections import deque
import copy #DeepCopy: hoge = [_[:] for _ in hogehoge]
#from functools import lru_cache
#@lru_cache(maxsize=None)
MOD = pow(10,9) + 7
#MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

def main():
    N,K = map(int,input().split())
    N2 = N * 2
    S = [str(input()) for _ in range(N2)]
    C = [list(map(int,input().split())) for _ in range(N2)]

    black = 0
    L = []
    for i in range(N2):
        for j in range(N2):
            L.append(C[i][j])
            if S[i][j] == '#':
                black += 1
    L.sort(reverse=True)
    ans = sum(L[:black])

    if black%2 == 1:
        print(ans)
    
    L = []
    for i in range(N2):
        for j in range(N):
            temp = C[i][j] + C[i][N2-1-j]
            L.append(temp)
    L.sort(reverse=True)

    tans = sum(L[:(black//2)]) + K
    ans = max(ans, tans)

    print(ans)


if __name__ == '__main__':
    main()
0