백준 1915 가장 큰 정사각형 문제와 여러개의 테스트 케이스가 있다는 점만 빼면 동일한 문제.
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int map[1001][1001];
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n, m;
while(cin >> n >> m){
if(!n && !m) return 0;
int ans = 0;
memset(map, 0, sizeof(map));
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
cin >> map[i][j];
}
}
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
if(!map[i][j]) continue;
map[i][j] = min({map[i-1][j-1], map[i][j-1], map[i-1][j]}) + 1;
ans = max(ans, map[i][j]);
}
}
cout << ans << "\n";
}
}
백준 1028 다이아몬드 광산 혼내주기 (0) | 2021.08.01 |
---|---|
백준 17485 진우의 달 여행 (Large) 혼내주기 (0) | 2021.08.01 |
백준 20164 홀수 홀릭 호석 혼내주기 (0) | 2021.08.01 |
백준 20165 인내의 도미노 장인 호석 혼내주기 (0) | 2021.08.01 |
백준 20166 문자열 지옥에 빠진 호석 혼내주기 (0) | 2021.08.01 |
댓글 영역