結果
問題 | No.2094 Symmetry |
ユーザー |
|
提出日時 | 2023-04-29 02:19:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 108,800 KB |
最終ジャッジ日時 | 2024-11-18 01:09:09 |
合計ジャッジ時間 | 6,600 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 WA * 1 |
ソースコード
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 = 0xs = []for x in range(2 * n):for y in range(2 * n):if s[x][y] == "#":cnt += 1xs.append(c[x][y])xs.sort()ans = sum(xs[- cnt:])if cnt == 0 or cnt % 2 != 0:if cnt == 0:ans = max(ans, k)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)