Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <algorithm>
- #include <cstring>
- #include <string.h>
- #include <time.h>
- #include <stdio.h>
- #include <vector>
- #include <cmath>
- using namespace std;
- typedef long long ll;
- typedef double db;
- int b,max1,rez,k,m,k1,k2,k3,k4,k5,k6,i,n,j;
- int a[1001][1001],dp[1001][1001];
- ll gcd(ll a, ll b)
- {
- if (a<b) swap(a,b);
- if (b==0) return a; else
- return gcd(b,a%b);
- }
- int main()
- {
- char c;
- freopen("INPUT.TXT","r",stdin);
- freopen("OUTPUT.TXT","w",stdout);
- cin>>n;
- for (i=0;i<n;i++)
- for (j=0;j<n;j++)
- {
- cin>>c;
- a[i][j]=(int)c-48;
- if (a[i][j]==1) dp[i][j]=1; else dp[i][j]=0;
- }
- int max1=1;
- for (i=1;i<n;i++)
- for (j=1;j<n;j++)
- if (dp[i][j]>0&&dp[i-1][j-1]>0&&dp[i-1][j]>0&&dp[i][j-1]>0)
- {
- k1=min(min(dp[i-1][j-1],dp[i][j-1]),dp[i-1][j]);
- dp[i][j]=(sqrt((db)k1)+1)*(sqrt((db)k1)+1);
- if (dp[i][j]>max1) max1=dp[i][j];
- }
- cout<<max1<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment