We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6957b9 commit b83426aCopy full SHA for b83426a
weekly/week04/BOJ_14925_목장건설하기/Gyuhyeok99.cpp
@@ -0,0 +1,37 @@
1
+#include <iostream>
2
+
3
+using namespace std;
4
5
+int n, m, ret;
6
+int arr[1001][1001], dp[1001][1001];
7
8
+int main() {
9
+ ios::sync_with_stdio(false);
10
+ cin.tie(NULL); cout.tie(NULL);
11
12
+ cin >> m >> n;
13
14
+ for (int i = 1; i <= m; i++) {
15
+ for (int j= 1; j <= n; j++) {
16
+ cin >> arr[i][j];
17
+ }
18
19
20
21
+ for (int j = 1; j <= n; j++) {
22
+ if (!arr[i][j]) {
23
+ if (!dp[i - 1][j - 1] || !dp[i][j - 1] || !dp[i - 1][j]) {
24
+ dp[i][j] = 1;
25
26
+ else {
27
+ dp[i][j] = min(min(dp[i - 1][j - 1], dp[i][j - 1]), dp[i - 1][j]) + 1;
28
29
+ ret = max(ret, dp[i][j]);
30
31
32
33
34
+ cout << ret << '\n';
35
36
+ return 0;
37
+}
0 commit comments