제출 #91489

#제출 시각아이디문제언어결과실행 시간메모리
91489davitmargBomb (IZhO17_bomb)C++17
24 / 100
450 ms25220 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;

int n, m,w,h;
int mp[2503][2503];
char tmp;
int main()
{
	cin >> n >> m;
	w = h = mod;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
		{
			cin >> tmp;
			mp[i][j] = tmp - '0';
		}
	for (int i = 0; i < n; i++)
	{
		int l = 0;
		for (int 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 (int i = 0; i < m; i++)
	{
		int l = 0;
		for (int 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);
	}
	cout << w * h << endl;
	return 0;
}


/*

7 8
01001110
01001110
01001100
00000000
01000000
01000000
01000000


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