S1K2N3 @ 2018-08-07 09:22:14
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m,dp[2502][2502],a[2502][2502],s[2502][2502];
int main(){
ios::sync_with_stdio(false);
while(cin>>n>>m){
memset(dp,0,sizeof(dp));int ans=0;
memset(s,0,sizeof(s));
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+a[i][j];
if(a[i][j]==0) dp[i][j]=0;
else dp[i][j]=dp[i-1][j-1]+1;
int k=dp[i][j];
while(s[i][j]-s[i-k][j]-s[i][j-k]+s[i-k][j-k]!=k && k>0) k--;
dp[i][j]=k;
ans=max(ans,k);
}
}memset(dp,0,sizeof(dp));
memset(s,0,sizeof(s));
for(int i=1;i<=n;i++){
for(int j=m;j>=1;j--){
s[i][j]=s[i-1][j]+s[i][j+1]-s[i-1][j+1]+a[i][j];
if(a[i][j]==0) dp[i][j]=0;
else dp[i][j]=dp[i-1][j+1]+1;
int k=dp[i][j];
while(s[i][j]-s[i-k][j]-s[i][j+k]+s[i-k][j+k]!=k && k>0) k--;
dp[i][j]=k;
ans=max(ans,k);
}
}
cout<<ans<<endl;
}
}
by henrytb @ 2018-08-07 09:25:11
编译信息?
by 夜刀神十香ღ @ 2018-08-07 09:25:25
@S1K2N3 重交,看RP
by HikariForever @ 2018-08-07 09:25:42
@S1K2N3 评测机故障
by S1K2N3 @ 2018-08-07 09:28:49
@夜刀神十香ღ 交了5遍。。
by S1K2N3 @ 2018-08-07 09:28:55
@四代目火影 谢谢
by azihmst @ 2018-08-07 09:30:59
评测机的锅