結果
問題 | No.2094 Symmetry |
ユーザー |
![]() |
提出日時 | 2022-10-01 10:57:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 177 ms / 2,000 ms |
コード長 | 608 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 82,228 KB |
実行使用メモリ | 106,636 KB |
最終ジャッジ日時 | 2024-12-23 15:29:50 |
合計ジャッジ時間 | 7,151 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
n,k=map(int,input().split())cnt=0for i in range(2*n):s=list(input())cnt+=s.count("#")c=[[]]for i in range(2*n):c.append([0]+list(map(int,input().split())))#シンメトリーじゃないx=[]for i in range(1,2*n+1):for j in range(1,2*n+1):x.append(c[i][j])x.sort(reverse=True)res=0for i in range(cnt):res+=x[i]ans=res#シンメトリーif cnt%2==0:x=[]for i in range(1,2*n+1):for j in range(1,n+1):x.append(c[i][j]+c[i][2*n+1-j])x.sort(reverse=True)res=kfor i in range(cnt//2):res+=x[i]ans=max(ans,res)print(ans)