結果

問題 No.2094 Symmetry
ユーザー FromBooskaFromBooska
提出日時 2023-06-02 22:27:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 898 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 95,632 KB
最終ジャッジ日時 2023-08-28 04:20:44
合計ジャッジ時間 9,531 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,488 KB
testcase_01 AC 72 ms
71,384 KB
testcase_02 AC 71 ms
71,492 KB
testcase_03 AC 71 ms
71,624 KB
testcase_04 AC 70 ms
71,104 KB
testcase_05 AC 72 ms
71,276 KB
testcase_06 AC 71 ms
71,568 KB
testcase_07 AC 72 ms
71,268 KB
testcase_08 AC 72 ms
71,268 KB
testcase_09 AC 206 ms
91,880 KB
testcase_10 AC 203 ms
91,672 KB
testcase_11 AC 203 ms
92,636 KB
testcase_12 AC 206 ms
92,120 KB
testcase_13 AC 205 ms
91,684 KB
testcase_14 AC 205 ms
91,740 KB
testcase_15 AC 205 ms
91,908 KB
testcase_16 AC 205 ms
91,908 KB
testcase_17 AC 204 ms
91,740 KB
testcase_18 AC 205 ms
91,728 KB
testcase_19 AC 207 ms
92,148 KB
testcase_20 AC 207 ms
91,944 KB
testcase_21 AC 205 ms
92,264 KB
testcase_22 AC 207 ms
91,748 KB
testcase_23 AC 205 ms
91,868 KB
testcase_24 AC 207 ms
91,800 KB
testcase_25 AC 208 ms
91,864 KB
testcase_26 AC 205 ms
91,852 KB
testcase_27 AC 70 ms
71,368 KB
testcase_28 AC 140 ms
91,844 KB
testcase_29 AC 73 ms
71,388 KB
testcase_30 AC 139 ms
91,712 KB
testcase_31 AC 143 ms
91,956 KB
testcase_32 AC 143 ms
91,912 KB
testcase_33 AC 71 ms
71,436 KB
testcase_34 AC 137 ms
95,632 KB
testcase_35 AC 136 ms
93,796 KB
testcase_36 AC 136 ms
94,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 黒マスの数Bは変わらない
# 対称がなければ、最大値B個選べばいい
# 対称があるには、Bは偶数必要
# 対称となる中でベストB個を選ぶ
# 対称で調べる場合は、ペアごとのスコアを調べてそのベストB//2個を選べばいい
# 対称と非対称の大きい値が答え

N, K = map(int, input().split())
S = []
B = 0
for i in range(N*2):
    temp = input()
    S.append(temp)
    B += temp.count('#')

C = []
singles = []
pairs = []
for i in range(N*2):
    temp = list(map(int, input().split()))
    C.append(temp)
    singles.extend(temp)
    for j in range(N):
        calc = temp[j] + temp[-1-j]
        pairs.append(calc)
singles.sort(reverse = True)
pairs.sort(reverse = True)

if B%2 == 1:
    ans = sum(singles[:B])
else:
    ans1 = sum(singles[:B])
    ans2 = sum(pairs[:B//2])+K
    ans = max(ans1, ans2)
print(ans)







0