# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170218 | andrew | Bomb (IZhO17_bomb) | C++17 | 127 ms | 8100 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("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MAXN = 1123456;
const ll N = 2e6;
const ll inf = 3e18;
mt19937_64 rnd(chrono::system_clock::now().time_since_epoch().count());
template <typename T> void vout(T s){cout << s << endl;exit(0);}
char c[3001][3001];
int main(){
ios_base :: sync_with_stdio(0);
cin.tie(0);
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // LOCAL
ll n, m;
ll h, w;
h = w = inf;
cin >> n >> m;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)cin >> c[i][j];
for(int i = 1; i <= n; i++){
ll kol = 0;
for(int j = 1; j <= m; j++){
if(c[i][j] == '0'){
if(kol)h = min(h, kol);
kol = 0;
}else kol++;
}
if(kol)h = min(h, kol);
}
for(int j = 1; j <= m; j++){
ll kol = 0;
for(int i = 1; i <= n; i++){
if(c[i][j] == '0'){
if(kol)w = min(w, kol);
kol = 0;
}else kol++;
}
if(kol)w = min(w, kol);
}
cout << h * w << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |