제출 #1102920

#제출 시각아이디문제언어결과실행 시간메모리
1102920MuhammetBomb (IZhO17_bomb)C++17
24 / 100
227 ms6548 KiB
#include <bits/stdc++.h>

using namespace std;

const int N = 2505;

int n, m;

char c[N][N];

int main(){
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			cin >> c[i][j];
		}
	}
	int a = m;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			int ind, a1 = 0;
			for(ind = j; ind <= m; ind++){
				if(c[i][ind] == '0') break;
				a1++;
			}
			if(a1 != 0) a = min(a,a1);
			j = ind;
		}
	}
	int b = n;
	for(int j = 1; j <= m; j++){
		for(int i = 1; i <= n; i++){
			int ind, b1 = 0;
			for(ind = i; ind <= n; ind++){
				if(c[ind][j] == '0') break;
				b1++;
			}
			i = ind;
			if(b1 != 0) b = min(b,b1);
		}
	}
	if(c[1][1] == '0' and a*b == n*m) cout << 0;
	else cout << a*b;
}
#Verdict Execution timeMemoryGrader output
Fetching results...