# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
343261 | Pety | Bomb (IZhO17_bomb) | C++14 | 490 ms | 61732 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;
int n, m, w, h, dp[2502][2502], dp2[2502][2502];
char v[2502][2502];
int main()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
cin >> v[i][j];
if (v[i][j] == '1') {
dp[i][j] = dp[i][j - 1] + 1;
dp2[i][j] = dp2[i - 1][j] + 1;
}
}
int w = 1e9, h = 1e9;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) {
if ((j == m && v[i][j] == '1') || (v[i][j] == '1' && v[i][j + 1] == '0'))
w = min(w, dp[i][j]);
if ((i == n && v[i][j] == '1') || (v[i][j] == '1' && v[i + 1][j] == '0'))
h = min(h, dp2[i][j]);
}
cout << w * h << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |