# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
907249 | daoquanglinh2007 | Bomb (IZhO17_bomb) | C++17 | 87 ms | 7000 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.
#include <bits/stdc++.h>
using namespace std;
const int NM = 2500, inf = 1e9+7;
int N, M, H = +inf, W = +inf;
char a[NM+5][NM+5];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N >> M;
for (int i = 1; i <= N; i++)
for (int j = 1; j <= M; j++) cin >> a[i][j];
for (int j = 1; j <= M; j++)
for (int i = 1; i <= N; i++){
if (a[i][j] == '0') continue;
int k = i;
while (k <= N && a[k][j] == '1') k++;
H = min(H, k-i);
i = k-1;
}
for (int i = 1; i <= N; i++)
for (int j = 1; j <= M; j++){
if (a[i][j] == '0') continue;
int k = j;
while (k <= M && a[i][k] == '1') k++;
W = min(W, k-j);
j = k-1;
}
assert(H <= N && W <= M);
cout << H*W;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |