File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
- // Authored by : BaaaaaaaaaaarkingDog
1
+ // Authored by : Hot6Mania
2
2
// Co-authored by : -
3
- // http://boj.kr/****************
3
+ // http://boj.kr/e5fe7cb3d25e4e4d8e1d94eeb95f04c1
4
4
#include < bits/stdc++.h>
5
5
using namespace std ;
6
6
7
+ int n, m;
8
+ int board[1010 ][1010 ], d[1010 ][1010 ];
9
+
7
10
int main (void ){
8
11
ios::sync_with_stdio (0 );
9
12
cin.tie (0 );
10
13
11
- }
14
+ cin >> n >> m;
15
+ for (int i = 1 ; i <= n; ++i){
16
+ string s;
17
+ cin >> s;
18
+ for (int j = 1 ; j <= m; ++j)
19
+ board[i][j] = s[j-1 ] - ' 0' ;
20
+ }
21
+ int ans = 0 ;
22
+ for (int i = 1 ; i <= n; ++i){
23
+ for (int j = 1 ; j <= m; ++j){
24
+ if (board[i][j]){
25
+ d[i][j] = min ({d[i-1 ][j], d[i][j-1 ], d[i-1 ][j-1 ]}) + 1 ;
26
+ ans = max (ans, d[i][j]);
27
+ }
28
+ }
29
+ }
30
+ cout << ans * ans;
31
+ }
You can’t perform that action at this time.
0 commit comments