結果

問題 No.2094 Symmetry
ユーザー kyskys
提出日時 2022-10-07 21:45:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 1,110 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 94,508 KB
最終ジャッジ日時 2023-09-03 01:15:05
合計ジャッジ時間 7,855 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,496 KB
testcase_01 AC 70 ms
71,592 KB
testcase_02 AC 72 ms
71,364 KB
testcase_03 AC 72 ms
71,352 KB
testcase_04 AC 74 ms
71,360 KB
testcase_05 AC 70 ms
71,492 KB
testcase_06 AC 72 ms
71,328 KB
testcase_07 AC 73 ms
71,536 KB
testcase_08 AC 72 ms
71,468 KB
testcase_09 AC 201 ms
90,540 KB
testcase_10 AC 198 ms
90,644 KB
testcase_11 AC 202 ms
90,572 KB
testcase_12 AC 202 ms
90,696 KB
testcase_13 AC 181 ms
90,544 KB
testcase_14 AC 201 ms
90,588 KB
testcase_15 AC 201 ms
90,724 KB
testcase_16 AC 203 ms
90,276 KB
testcase_17 AC 180 ms
90,388 KB
testcase_18 AC 180 ms
90,556 KB
testcase_19 AC 201 ms
90,656 KB
testcase_20 AC 204 ms
90,368 KB
testcase_21 AC 203 ms
90,284 KB
testcase_22 AC 201 ms
90,392 KB
testcase_23 AC 180 ms
90,540 KB
testcase_24 AC 183 ms
90,392 KB
testcase_25 AC 204 ms
90,276 KB
testcase_26 AC 200 ms
90,648 KB
testcase_27 AC 72 ms
71,360 KB
testcase_28 AC 135 ms
90,600 KB
testcase_29 AC 74 ms
71,396 KB
testcase_30 AC 141 ms
90,468 KB
testcase_31 AC 138 ms
90,464 KB
testcase_32 AC 140 ms
90,604 KB
testcase_33 AC 70 ms
71,420 KB
testcase_34 AC 134 ms
94,508 KB
testcase_35 AC 136 ms
92,996 KB
testcase_36 AC 136 ms
93,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from sys import stdin, setrecursionlimit
    # setrecursionlimit(1000000)
    input = stdin.readline
    def iinput(): return int(input())
    def sinput(): return input().rstrip()
    def i0input(): return int(input()) - 1
    def linput(): return list(input().split())
    def liinput(): return list(map(int, input().split()))
    def miinput(): return map(int, input().split())
    def li0input(): return list(map(lambda x: int(x) - 1, input().split()))
    def mi0input(): return map(lambda x: int(x) - 1, input().split())
    INF = 1000000000000000000
    MOD = 1000000007

    N, K = miinput()
    S = []
    ctr = 0
    for _ in [0] * (2*N):
        tmp = sinput()
        S.append(tmp)
        ctr += tmp.count('#')
    
    C = []
    D = []
    for _ in [0] * (2*N):
        c = liinput()
        for k in c:
            C.append(k)
        for k, l in zip(c[:N], c[N:][::-1]):
            D.append(k+l)
    
    C.sort(reverse=True)
    ans = sum(C[:ctr])
    if ctr % 2 == 0:
        D.sort(reverse=True)
        ans = max(ans, K + sum(D[:ctr//2]))
    
    print(ans)
    


main()
0