# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91494 | davitmarg | Bomb (IZhO17_bomb) | C++17 | 463 ms | 25272 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
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 = m;
h = n;
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 sum = 0;
for (int j = 0; j < m; j++)
{
sum += mp[i][j];
if (mp[i][j] == 0)
{
w = min(sum,w);
sum = 0;
}
}
if(sum)
w = min(sum, w);
}
for (int i = 0; i < m; i++)
{
int sum = 0;
for (int j = 0; j < n; j++)
{
sum += mp[j][i];
if (mp[j][i] == 0)
{
h = min(sum, h);
sum = 0;
}
}
if (sum)
w = min(sum, h);
}
cout << max(w * h,1) << endl;
return 0;
}
/*
5 6
000000
111110
111111
111111
000000
7 8
01001110
01001110
01001100
00000000
01000000
01000000
01000000
7 8
01000000
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |