# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38356 | mirbek01 | Bomb (IZhO17_bomb) | C++14 | 406 ms | 8144 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>
#pragma GCC optimize("Ofast")
# define pb push_back
# define fr first
# define sc second
# define mk make_pair
using namespace std;
const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 2505;
typedef long long ll;
int n, m, a = inf, b = inf;
char ch[N][N];
int main(){
scanf("%d %d", &n, &m);
for(int i = 1; i <= n; i ++){
scanf("\n");
for(int j = 1; j <= m; j ++)
scanf("%c", &ch[i][j]);
}
for(int i = 1; i <= n; i ++){
int cur = 0;
for(int j = 1; j <= m; j ++){
if(ch[i][j] == '1') cur ++;
else{
if(cur) a = min(a, cur);
cur = 0;
}
}
if(cur) a = min(a, cur);
}
for(int i = 1; i <= m; i ++){
int cur = 0;
for(int j = 1; j <= n; j ++){
if(ch[j][i] == '1') cur ++;
else {
if(cur) b = min(b, cur);
cur = 0;
}
}
if(cur) b = min(b, cur);
}
if(a == inf) printf("0"); else
printf("%d", a * b);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |