# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170227 | nvmdava | Bomb (IZhO17_bomb) | C++17 | 135 ms | 6648 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("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,avx2")
using namespace std;
#define ll long long
#define ff first
#define ss second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define N 2505
char c[N][N];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m;
cin>>n>>m;
memset(c, '0', sizeof c);
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
cin>>c[i][j];
}
}
int w = 2500, h = 2500;
for(int i = 1; i <= n; i++){
int th = 0;
for(int j = 1; j <= m + 1; ++j){
if(c[i][j] == '0' && c[i][j - 1] == '1'){
h = min(th, h);
th = 0;
} else if(c[i][j] == '1'){
++th;
}
}
}
for(int i = 1; i <= m; i++){
int tw = 0;
for(int j = 1; j <= n + 1; ++j){
if(c[j][i] == '0' && c[j - 1][i] == '1'){
w = min(tw, w);
tw = 0;
} else if(c[j][i] == '1'){
++tw;
}
}
}
cout<<w * h;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |