제출 #91491

#제출 시각아이디문제언어결과실행 시간메모리
91491davitmargBomb (IZhO17_bomb)C++17
24 / 100
449 ms49796 KiB
/*
DEATH-MATCH
Davit-Marg
*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <ctype.h>
#include <stdlib.h>  
#include <fstream>  
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
using namespace std;

LL n, m,w,h;
LL mp[2503][2503];
char tmp;
int main()
{
	cin >> n >> m;
	w = h = mod;
	for (LL i = 0; i < n; i++)
		for (LL j = 0; j < m; j++)
		{
			cin >> tmp;
			mp[i][j] = tmp - '0';
		}
	for (LL i = 0; i < n; i++)
	{
		LL l = 0;
		for (LL j = 0; j < m; j++)
			if (mp[i][j] != 1)
			{
				if (j != l)
					w = min(w, j - l);
				l = j + 1;
			}
		if (m != l)
			w = min(w, m - l);
	}


	for (LL i = 0; i < m; i++)
	{
		LL l = 0;
		for (LL j = 0; j < n; j++)
			if (mp[j][i] != 1)
			{
				if(j!=l)
					h = min(h, j - l);
				l = j + 1;
			}
		if (n != l)
			h = min(h, n - l);
	}
	if (w == mod && h == mod)
		w = 0;
	cout << w * h << endl;
	return 0;
}


/*

7 8
01001110
01001110
01001100
00000000
01000000
01000000
01000000



7 8
00000000
00000000
00000000
00000000
00000000
00000000
00000000

7 8
11111111
11111111
11111111
11100111
11111111
11111111
11111111

7 8
00000000
00011000
00011000
00000000
00011111
00011111
00000000

*/
#Verdict Execution timeMemoryGrader output
Fetching results...