# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1106415 | stdfloat | Bomb (IZhO17_bomb) | C++17 | 1100 ms | 7180 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;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<string> a(n);
for (auto &i : a)
cin >> i;
int mn1 = n, mn2 = m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (a[i][j] == '0') continue;
int l = j, r = j;
while (0 < l && a[i][l - 1] == '1') l--;
while (r + 1 < m && a[i][r + 1] == '1') r++;
mn1 = min(mn1, r - l + 1);
l = r = i;
while (0 < l && a[l - 1][j] == '1') l--;
while (r + 1 < n && a[r + 1][j] == '1') r++;
mn2 = min(mn2, r - l + 1);
}
}
cout << mn1 * mn2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |