結果
問題 | No.2094 Symmetry |
ユーザー | kys |
提出日時 | 2022-10-07 21:45:35 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 161 ms / 2,000 ms |
コード長 | 1,110 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 82,600 KB |
実行使用メモリ | 91,132 KB |
最終ジャッジ日時 | 2024-06-12 06:50:11 |
合計ジャッジ時間 | 6,111 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
def main(): from sys import stdin, setrecursionlimit # setrecursionlimit(1000000) input = stdin.readline def iinput(): return int(input()) def sinput(): return input().rstrip() def i0input(): return int(input()) - 1 def linput(): return list(input().split()) def liinput(): return list(map(int, input().split())) def miinput(): return map(int, input().split()) def li0input(): return list(map(lambda x: int(x) - 1, input().split())) def mi0input(): return map(lambda x: int(x) - 1, input().split()) INF = 1000000000000000000 MOD = 1000000007 N, K = miinput() S = [] ctr = 0 for _ in [0] * (2*N): tmp = sinput() S.append(tmp) ctr += tmp.count('#') C = [] D = [] for _ in [0] * (2*N): c = liinput() for k in c: C.append(k) for k, l in zip(c[:N], c[N:][::-1]): D.append(k+l) C.sort(reverse=True) ans = sum(C[:ctr]) if ctr % 2 == 0: D.sort(reverse=True) ans = max(ans, K + sum(D[:ctr//2])) print(ans) main()