# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91427 | Abelyan | Bomb (IZhO17_bomb) | C++17 | 3 ms | 1064 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;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pr;
#define fr first
#define sc second
#define FOR(i, a) for (int i = 0; i < (a); i++)
#define F0R(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i,a) for (int i = (a)-1; i >= 0; i--)
#define F0Rd(i,a,b) for (int i = (b); i >= (a); i--)
#define trav(a, x) for (auto& a : x)
const int N=2506;
char c[N][N];
int main(){
ios_base::sync_with_stdio(false);
#ifndef EVAL
//freopen("input.txt","r",stdin);
#endif
int n,m;
cin>>n>>m;
assert(n<=20 && m<=20);
for (int i=0;i<n;i++){
cin>>c[i];
}
int mn=INT_MAX;
for (int i=0;i<n;i++){
int tv=0;
for (int j=0;j<m;j++){
if (c[i][j]=='1'){
tv++;
}
else if(tv!=0){
mn=min(mn,tv);
tv=0;
}
}
if (tv!=0)mn=min(mn,tv);
}
int ans1=mn;
mn=INT_MAX;
for (int j=0;j<m;j++){
int tv=0;
for (int i=0;i<n;i++){
if (c[i][j]=='1'){
tv++;
}
else if(tv!=0){
mn=min(mn,tv);
tv=0;
}
}
if (tv!=0)mn=min(mn,tv);
}
cout<<mn*ans1<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |