A. 打地鼠
A_code
#include<bits/stdc++.h>
using namespace std;
namespace BSS
{
#define ll long long int
#define re register ll
#define lf double
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define File(x,y) freopen(#x,"r",stdin),freopen(#y,"w",stdout)
#define Fill(x,y) memset(x,y,sizeof x);
#define Copy(x,y) memcpy(x,y,sizeof x);
inline ll read()
{
ll ss=0; bool cit=1; char ch;
while(!isdigit(ch=getchar())) if(ch=='-') cit=0;
while(isdigit(ch)) ss=(ss<<3)+(ss<<1)+(ch^48),ch=getchar();
return cit?ss:-ss;
}
} using namespace BSS;
const ll N=2051;
ll m,n,s,ans;
ll pre[N][N];
char ch[N];
signed main(){
n=read(); s=read();
for(re i=1;i<=n;i++){
scanf("%s",ch+1);
for(re j=1;j<=n;j++)
pre[i][j]=pre[i-1][j]+pre[i][j-1]-pre[i-1][j-1]+ch[j]-'0';
}
ll temp;
for(re i=s;i<=n;i++){
for(re j=s;j<=n;j++){
temp=pre[i][j]-pre[i-s][j]-pre[i][j-s]+pre[i-s][j-s];
ans=max(ans,temp);
}
}
printf("%lld",ans);
return 0;
}