1 solutions
-
1
#include<bits/stdc++.h> using namespace std; int a[15][15]; int main() { int n,m; cin>>n>>m; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { cin>>a[i][j]; } } int res=0; for(int x1=1;x1<=n;x1++) { for(int y1=1;y1<=m;y1++) { for(int x2=x1;x2<=n;x2++) { for(int y2=y1;y2<=m;y2++) { int c=0; bool st=true; for(int i=x1;i<=x2;i++) { for(int j=y1;j<=y2;j++) { if(a[i][j]==1) { c++; } else if(a[i][j]==0) { st=false; } } } if(st) { res=max(res,c); } } } } } cout<<res; return 0; }
Information
- ID
- 2890
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 7
- Accepted
- 4
- Uploaded By