結果

問題 No.2094 Symmetry
ユーザー 👑 p-adic
提出日時 2023-05-22 14:04:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 466 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 82,436 KB
最終ジャッジ日時 2024-12-22 09:24:34
合計ジャッジ時間 60,249 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 TLE * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

I=input
def J():
	return map(int,I().split())
def S(D):
	return sorted(D.items(),reverse=1)
N,K=J()
R=range(N*2)
b=0
for i in R:
	for c in I():b+=c=="#"
D,E={},{}
for i in R:
	C=list(J())
	for c in C:
		if c in D:D[c]+=1
		else:D[c]=1
	for i in R:
		c=C[i]+C[N*2-i-1]
		if c in E:E[c]+=i<N
		else:E[c]=1
F,G=S(D),S(E)
s=1-b%2
m=[0]*2
for a,e,k in [b,F,0],[b//2,G,1]:
	while (a>0)*len(e):
		i,j=e.pop(0)
		a,m[k]=max(0,a-j),m[k]+min(a,j)*i
print(max(m[0],(K+m[1])*s))
0