# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833488 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 34 ms | 7124 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;
string s[2505];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> s[i];
}
int W = m, H = n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (s[i][j] == '1') {
int cnt = 1;
while (j + 1 < m && s[i][j+1] == '1') {
j++;
cnt++;
}
W = min(W, cnt);
}
}
}
for (int j = 0; j < m; j++) {
for (int i = 0; i < n; i++) {
if (s[i][j] == '1') {
int cnt = 1;
while (i + 1 < n && s[i+1][j] == '1') {
i++;
cnt++;
}
H = min(H, cnt);
}
}
}
cout << W*H << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |