8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d64ce92 commit 5b2902fCopy full SHA for 5b2902f
Appendix E/1915.cpp
@@ -0,0 +1,37 @@
1
+#include <bits/stdc++.h>
2
+using namespace std;
3
+
4
+int n, m;
5
+string board[1005];
6
+int d[1005][1005];
7
8
+int main(void) {
9
+ ios::sync_with_stdio(0);
10
+ cin.tie(0);
11
12
+ cin >> n >> m;
13
+ for(int i = 0; i < n; i++)
14
+ cin >> board[i];
15
16
17
+ d[i][0] = board[i][0] - '0';
18
19
+ for(int j = 0; j < m; j++)
20
+ d[0][j] = bo AA2E ard[0][j] - '0';
21
22
+ for(int i = 1; i < n; i++){
23
+ for(int j = 1; j < m; j++){
24
+ if(board[i][j] == '0')
25
+ continue;
26
+ d[i][j] = min({d[i-1][j], d[i-1][j-1], d[i][j-1]}) + 1;
27
+ }
28
29
30
+ int ans = 0;
31
+ for(int i = 0; i < n; i++){
32
33
+ ans = max(ans, d[i][j]);
34
35
36
+ cout << ans * ans << '\n';
37
+}
0 commit comments