# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333917 | amunduzbaev | Bomb (IZhO17_bomb) | C++14 | 205 ms | 25672 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;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ll long long
#define ld long double
#define pii pair<int, int>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define prc(n) fixed << setprecision(n)
#define fastios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi acos(-1);
const int inf = 1e9+7;
const int N = 2505;
int a[N][N];
int n, m;
void solve(){
fastios
cin>>n>>m;
int mnr = inf, mnc = inf;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
char c;
cin>>c;
a[i][j] = (c - '0' ? 1:0);
}
for(int j=0;j<m;j++){
int l = j;
while(a[i][l] == a[i][j] && a[i][j] && l<m) l++;
mnr = min(mnr, (l - j == 0 ? inf : l - j));
j = l;
}
}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
int l = j;
while(a[l][i] == a[j][i] && a[j][i] && l<n) l++;
mnc = min(mnc, (l - j == 0 ? inf : l - j));
j = l;
}
}
cout<<mnc * mnr<<"\n";
return;
}
int main(){
fastios
int t = 1;
//cin>>t;
while(t--) solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |