結果

問題 No.2094 Symmetry
ユーザー qibqib
提出日時 2023-04-29 02:23:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 108,800 KB
最終ジャッジ日時 2024-04-29 02:22:23
合計ジャッジ時間 6,747 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,840 KB
testcase_01 AC 41 ms
51,712 KB
testcase_02 AC 44 ms
52,096 KB
testcase_03 AC 41 ms
51,840 KB
testcase_04 AC 41 ms
52,096 KB
testcase_05 AC 41 ms
51,968 KB
testcase_06 AC 42 ms
51,712 KB
testcase_07 AC 41 ms
52,096 KB
testcase_08 AC 40 ms
51,968 KB
testcase_09 AC 205 ms
108,032 KB
testcase_10 AC 202 ms
107,776 KB
testcase_11 AC 206 ms
108,800 KB
testcase_12 AC 206 ms
108,544 KB
testcase_13 AC 173 ms
98,816 KB
testcase_14 AC 204 ms
108,544 KB
testcase_15 AC 204 ms
108,416 KB
testcase_16 AC 206 ms
108,160 KB
testcase_17 AC 173 ms
98,816 KB
testcase_18 AC 171 ms
98,688 KB
testcase_19 AC 204 ms
108,416 KB
testcase_20 AC 204 ms
108,672 KB
testcase_21 AC 205 ms
108,800 KB
testcase_22 AC 206 ms
107,392 KB
testcase_23 AC 173 ms
99,328 KB
testcase_24 AC 173 ms
99,200 KB
testcase_25 AC 205 ms
108,416 KB
testcase_26 AC 205 ms
107,904 KB
testcase_27 AC 41 ms
51,712 KB
testcase_28 AC 116 ms
95,488 KB
testcase_29 AC 41 ms
51,968 KB
testcase_30 AC 119 ms
95,872 KB
testcase_31 AC 132 ms
107,136 KB
testcase_32 AC 134 ms
107,136 KB
testcase_33 AC 41 ms
51,840 KB
testcase_34 AC 136 ms
105,600 KB
testcase_35 AC 135 ms
105,728 KB
testcase_36 AC 119 ms
98,816 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)]

cnt = 0
xs = []
for x in range(2 * n):
  for y in range(2 * n):
    if s[x][y] == "#":
      cnt += 1
    xs.append(c[x][y])

if cnt == 0:
  print(k)
  exit()

xs.sort()
ans = sum(xs[- cnt:])
if cnt % 2 != 0:
  print(ans)
  exit()

xs = []
for x in range(2 * n):
  for y in range(n):
    xs.append(c[x][y] + c[x][2 * n - 1 - y])

xs.sort()
ans = max(ans, sum(xs[- (cnt // 2):]) + k)
print(ans)
0