# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
349033 | SeDunion | Bomb (IZhO17_bomb) | C++17 | 211 ms | 12780 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;
const int N = 1e6 + 66;
int n, m;
char c[2502][2502];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n >> m;
for (int i = 0 ; i < n ; ++ i) {
for (int j = 0 ; j < m ; ++ j) {
cin >> c[i][j];
}
}
int mnX = N;
for (int i = 0 ; i < n ; ++ i) {
int cur = 0;
for (int j = 0 ; j < m ; ++ j) {
if (c[i][j] == '0') {
if (j && c[i][j - 1] == '1') {
mnX = min(mnX, cur);
}
cur = 0;
} else {
cur++;
}
}
if (c[i][m - 1] == '1') {
mnX = min(mnX, cur);
}
}
int mnY = N;
for (int i = 0 ; i < m ; ++ i) {
int cur = 0;
for (int j = 0 ; j < n ; ++ j) {
if (c[j][i] == '0') {
if (j && c[j - 1][i] == '1') {
mnY = min(mnY, cur);
}
cur = 0;
} else {
cur++;
}
}
if (c[n - 1][i] == '1') {
mnY = min(mnY, cur);
}
}
//cout << mnX << " " << mnY << endl;
cout << mnX * mnY;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |