# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91363 | emil_physmath | Bomb (IZhO17_bomb) | C++17 | 318 ms | 17316 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 <iostream>
#include <stdio.h>
using namespace std;
bool a[2505][2505], temp[2505][2505];
int FindLen(int n, int m);
int main()
{
int n, m;
cin>>n>>m;
for (int i=0; i<n; i++)
for (int j=0; j<m; j++)
{
char temp;
scanf(" %c", &temp);
a[i][j]=(temp=='1'?true:false);
}
int len=FindLen(n, m);
for (int i=0; i<n; i++)
for (int j=0; j<m; j++)
temp[j][i]=a[i][j];
swap(n, m);
for (int i=0; i<n; i++)
for (int j=0; j<m; j++)
a[i][j]=temp[i][j];
int wid=FindLen(n, m);
cout<<wid*len<<'\n';
char I;
cin >> I;
return 0;
}
int FindLen(int n, int m)
{
int minLen=-1;
for (int i=0; i<n; i++)
for (int stj=0; stj<m; stj++)
{
int j=stj;
if (!a[i][j]) continue;
while (j+1<m && a[i][j+1])
j++;
if (minLen==-1 || j-stj+1<minLen)
minLen=j-stj+1;
stj=j;
}
return minLen==-1?0:minLen;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |