-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1051.cpp
More file actions
51 lines (47 loc) · 1.03 KB
/
1051.cpp
File metadata and controls
51 lines (47 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <vector>
using namespace std;
vector<int> v;
int arr[51][51];
int n,m,len;
int main(int argc, char** argv)
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int a;
int flag = 0;
cin>>n>>m;
string str;
for (int i = 0; i < n; ++i)
{
cin>>str;
for (int j = 0; j < m; ++j)
{
arr[i][j] = str[j] - '0';
}
}
if(n>m) len = m;
else len = n;
for (int i = len-1; i > 0; --i)
{
for (int j = 0; j < n; ++j)
{
for (int k = 0; k < m; ++k)
{
if(j+i<n&&k+i<m)
{
if(arr[j][k]==arr[j+i][k]&&arr[j][k]==arr[j][k+i]&&arr[j][k]==arr[j+i][k+i]){
cout<<(i+1)*(i+1)<<"\n";
flag = 1;
break;
}
}
}
if (flag==1) break;
}
if (flag==1) break;
}
if(flag==0) cout<<1<<"\n";
return 0;
}