結果

問題 No.2094 Symmetry
ユーザー 👑 rin204rin204
提出日時 2022-10-07 21:26:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 106,968 KB
最終ジャッジ日時 2023-09-03 00:03:48
合計ジャッジ時間 8,309 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,512 KB
testcase_01 AC 64 ms
71,360 KB
testcase_02 AC 66 ms
71,464 KB
testcase_03 AC 66 ms
71,376 KB
testcase_04 AC 65 ms
71,556 KB
testcase_05 AC 66 ms
71,464 KB
testcase_06 AC 64 ms
71,204 KB
testcase_07 AC 65 ms
71,384 KB
testcase_08 AC 64 ms
71,536 KB
testcase_09 AC 208 ms
101,200 KB
testcase_10 AC 204 ms
101,008 KB
testcase_11 AC 201 ms
101,624 KB
testcase_12 AC 200 ms
101,484 KB
testcase_13 AC 175 ms
98,804 KB
testcase_14 AC 200 ms
101,680 KB
testcase_15 AC 198 ms
101,572 KB
testcase_16 AC 200 ms
101,416 KB
testcase_17 AC 177 ms
98,548 KB
testcase_18 AC 175 ms
98,236 KB
testcase_19 AC 196 ms
101,880 KB
testcase_20 AC 198 ms
101,748 KB
testcase_21 AC 206 ms
102,156 KB
testcase_22 AC 202 ms
100,992 KB
testcase_23 AC 175 ms
98,944 KB
testcase_24 AC 170 ms
98,612 KB
testcase_25 AC 199 ms
101,740 KB
testcase_26 AC 202 ms
101,384 KB
testcase_27 AC 69 ms
71,544 KB
testcase_28 AC 136 ms
103,824 KB
testcase_29 AC 64 ms
71,336 KB
testcase_30 AC 139 ms
103,684 KB
testcase_31 AC 141 ms
106,968 KB
testcase_32 AC 136 ms
106,740 KB
testcase_33 AC 65 ms
71,312 KB
testcase_34 AC 131 ms
106,120 KB
testcase_35 AC 136 ms
106,100 KB
testcase_36 AC 128 ms
98,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
S = [input() for _ in range(2 * n)]
C = [list(map(int, input().split())) for _ in range(2 * n)]
c = 0
for row in S:
    for s in row:
        if s == "#":
            c += 1

lst = []
for row in C:
    lst += row
lst.sort(reverse=True)
ans = sum(lst[:c])
if c % 2 == 0:
    lst = []
    for i in range(2 * n):
        for j in range(n):
            lst.append(C[i][j] + C[i][2 * n - 1 - j])
    lst.sort(reverse=True)
    tmp = sum(lst[:c // 2]) + k
    ans = max(ans, tmp)
print(ans)
0