結果

問題 No.2094 Symmetry
ユーザー AkariAkari
提出日時 2022-10-07 22:18:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 43,096 KB
最終ジャッジ日時 2023-09-03 13:13:19
合計ジャッジ時間 10,601 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
29,748 KB
testcase_01 AC 137 ms
29,672 KB
testcase_02 AC 137 ms
29,712 KB
testcase_03 AC 135 ms
29,652 KB
testcase_04 AC 138 ms
29,572 KB
testcase_05 AC 138 ms
29,788 KB
testcase_06 AC 140 ms
29,524 KB
testcase_07 AC 140 ms
29,652 KB
testcase_08 AC 139 ms
29,712 KB
testcase_09 AC 203 ms
37,328 KB
testcase_10 AC 203 ms
36,588 KB
testcase_11 AC 208 ms
39,772 KB
testcase_12 AC 200 ms
38,116 KB
testcase_13 AC 186 ms
36,848 KB
testcase_14 AC 205 ms
37,928 KB
testcase_15 AC 203 ms
39,484 KB
testcase_16 AC 196 ms
37,116 KB
testcase_17 AC 186 ms
36,876 KB
testcase_18 AC 185 ms
38,364 KB
testcase_19 AC 205 ms
38,104 KB
testcase_20 AC 202 ms
38,144 KB
testcase_21 AC 199 ms
38,176 KB
testcase_22 AC 202 ms
36,928 KB
testcase_23 AC 190 ms
38,608 KB
testcase_24 AC 191 ms
37,928 KB
testcase_25 AC 202 ms
36,720 KB
testcase_26 AC 200 ms
37,048 KB
testcase_27 AC 137 ms
29,640 KB
testcase_28 AC 158 ms
34,880 KB
testcase_29 AC 137 ms
29,604 KB
testcase_30 AC 156 ms
35,264 KB
testcase_31 AC 184 ms
43,064 KB
testcase_32 AC 184 ms
43,096 KB
testcase_33 AC 137 ms
29,720 KB
testcase_34 AC 166 ms
35,908 KB
testcase_35 AC 166 ms
35,704 KB
testcase_36 AC 173 ms
42,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np


def main():
    n, k = map(int, input().split())
    m = 0
    for i in range(2 * n): m += input().count('#')
    C = np.fromstring(sys.stdin.read(), np.int64, sep=' ').reshape(-1, 2 * n)

    def f(A, x):
        if x == 0: return 0
        return sum(np.sort(A.ravel())[-x:].tolist())

    ans = f(C, m)
    if ~m & 1:
        ans = max(ans, f(C[:, :n] + np.fliplr(C[:, n:]), m // 2) + k)
    print(ans)



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