結果

問題 No.2094 Symmetry
ユーザー flygonflygon
提出日時 2022-10-07 21:39:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 591 ms / 2,000 ms
コード長 609 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 114,388 KB
最終ジャッジ日時 2023-09-03 00:54:10
合計ジャッジ時間 14,567 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,332 KB
testcase_01 AC 73 ms
71,392 KB
testcase_02 AC 74 ms
71,328 KB
testcase_03 AC 74 ms
71,268 KB
testcase_04 AC 75 ms
71,424 KB
testcase_05 AC 73 ms
71,216 KB
testcase_06 AC 74 ms
71,440 KB
testcase_07 AC 75 ms
71,580 KB
testcase_08 AC 76 ms
71,552 KB
testcase_09 AC 572 ms
103,200 KB
testcase_10 AC 584 ms
103,456 KB
testcase_11 AC 579 ms
103,252 KB
testcase_12 AC 583 ms
103,524 KB
testcase_13 AC 452 ms
103,116 KB
testcase_14 AC 585 ms
102,876 KB
testcase_15 AC 591 ms
102,824 KB
testcase_16 AC 580 ms
102,804 KB
testcase_17 AC 436 ms
102,992 KB
testcase_18 AC 441 ms
103,680 KB
testcase_19 AC 580 ms
102,796 KB
testcase_20 AC 585 ms
103,692 KB
testcase_21 AC 586 ms
102,592 KB
testcase_22 AC 578 ms
103,620 KB
testcase_23 AC 446 ms
103,760 KB
testcase_24 AC 437 ms
103,516 KB
testcase_25 AC 590 ms
103,524 KB
testcase_26 AC 582 ms
103,000 KB
testcase_27 AC 73 ms
71,384 KB
testcase_28 AC 185 ms
114,388 KB
testcase_29 AC 72 ms
71,420 KB
testcase_30 AC 187 ms
112,824 KB
testcase_31 AC 191 ms
113,792 KB
testcase_32 AC 188 ms
111,636 KB
testcase_33 AC 76 ms
71,184 KB
testcase_34 AC 187 ms
99,156 KB
testcase_35 AC 246 ms
104,804 KB
testcase_36 AC 245 ms
106,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

mx = []
for i in range(2*n):
  for j in range(2*n):
    mx.append(c[i][j])

mx.sort(key = lambda x:-x)
ans = 0
for i in range(cnt):
  ans += mx[i]

if cnt % 2 == 1:
  print(ans)
else:
  syn = []
  for i in range(2*n):
    for j in range(n):
      syn.append(c[i][j] + c[i][2*n-j-1])
  syn.sort(key = lambda x:-x)
  ans2 = 0
  for i in range(cnt//2):
    ans2 += syn[i]
  print(max(ans, ans2+k))

0