# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833247 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 206 ms | 6388 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 <stdio.h>
int main() {
int n,m;
scanf("%d %d",&n,&m); getchar();
bool arr[n][m];
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
char c;
scanf("%c",&c);
arr[i][j] = (c == '1');
} getchar();
}
int h = 5000, w = 5000;
for(int i = 0; i < n; i++) {
int thisH = 5000, cur = 0;
for(int j = 0; j < m; j++) {
if(arr[i][j])
cur++;
if(cur && (!arr[i][j] || j == m-1)) {
thisH = cur < thisH ? cur : thisH;
cur = 0;
}
}
h = thisH < h ? thisH : h;
}
for(int i = 0; i < m; i++) {
int thisW = 5000, cur = 0;
for(int j = 0; j < n; j++) {
if(arr[j][i])
cur++;
if(cur && (!arr[j][i] || j == n-1)) {
thisW = cur < thisW ? cur : thisW;
cur = 0;
}
}
w = thisW < w ? thisW : w;
}
printf("%d\n",h < 5000 && w < 5000 ? h*w : 1);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |