# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
343401 | ivan_tudor | Bomb (IZhO17_bomb) | C++14 | 50 ms | 6636 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;
const int N = 2505;
char mat[N][N];
int main()
{
//freopen(".in","r",stdin);
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int n, m;
cin>>n>>m>>ws;
for(int i=1;i<=n;i++){
cin.getline(mat[i] + 1, N);
}
int l = INT_MAX, h = INT_MAX;
for(int i=1;i<=n;i++){
int cur = 0;
for(int j =1; j<=m;j++){
if(mat[i][j] == '1')
cur++;
if((mat[i][j] == '0' && mat[i][j-1] == '1') || (j == m && mat[i][j] == '1')){
l = min(l, cur);
cur = 0;
}
}
}
for(int i=1;i<=m;i++){
int cur = 0;
for(int j =1; j<=n;j++){
if(mat[j][i] == '1')
cur++;
if((mat[j][i] == '0' && mat[j - 1][i] == '1') || (j == n && mat[j][i] == '1')){
h = min(h, cur);
cur = 0;
}
}
}
cout<<l * h;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |