結果

問題 No.2094 Symmetry
ユーザー tnogamitnogami
提出日時 2022-10-08 14:42:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 27,712 KB
最終ジャッジ日時 2023-09-04 20:10:17
合計ジャッジ時間 10,702 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,784 KB
testcase_01 AC 15 ms
7,832 KB
testcase_02 AC 15 ms
7,852 KB
testcase_03 AC 16 ms
7,812 KB
testcase_04 AC 15 ms
7,780 KB
testcase_05 AC 16 ms
7,804 KB
testcase_06 AC 15 ms
7,804 KB
testcase_07 AC 16 ms
7,900 KB
testcase_08 AC 15 ms
7,832 KB
testcase_09 AC 335 ms
26,484 KB
testcase_10 AC 325 ms
26,480 KB
testcase_11 AC 338 ms
27,268 KB
testcase_12 AC 326 ms
26,656 KB
testcase_13 AC 325 ms
27,076 KB
testcase_14 AC 328 ms
27,016 KB
testcase_15 AC 332 ms
27,080 KB
testcase_16 AC 329 ms
27,028 KB
testcase_17 AC 320 ms
27,056 KB
testcase_18 AC 325 ms
26,520 KB
testcase_19 AC 327 ms
27,056 KB
testcase_20 AC 335 ms
27,060 KB
testcase_21 AC 328 ms
27,056 KB
testcase_22 AC 327 ms
26,556 KB
testcase_23 AC 326 ms
27,012 KB
testcase_24 AC 320 ms
27,096 KB
testcase_25 AC 319 ms
27,088 KB
testcase_26 AC 316 ms
27,076 KB
testcase_27 AC 15 ms
7,828 KB
testcase_28 AC 194 ms
27,620 KB
testcase_29 AC 16 ms
7,896 KB
testcase_30 AC 202 ms
27,536 KB
testcase_31 AC 216 ms
27,508 KB
testcase_32 AC 216 ms
27,712 KB
testcase_33 AC 15 ms
7,836 KB
testcase_34 AC 193 ms
22,968 KB
testcase_35 AC 200 ms
22,776 KB
testcase_36 AC 215 ms
26,624 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_1dim = []
symetry_point = []

black_ct = 0
for i in range(2*N):
    for j in range(2*N):
        if S[i][j] == "#":
            black_ct += 1
        C_1dim.append(C[i][j])

    for k in range(N):
        symetry_point.append(C[i][k]+C[i][-(k+1)])

C_1dim.sort()
symetry_point.sort()

ans = sum(C_1dim[-black_ct:])
if black_ct == 0:
    print(K)
elif black_ct%2 == 1:
    print(ans)
else:
    print(max(ans, sum(symetry_point[-(black_ct//2):])+K)) 
0