Submission #556093

#TimeUsernameProblemLanguageResultExecution timeMemory
556093ngpin04Bomb (IZhO17_bomb)C++14
24 / 100
88 ms31240 KiB
#include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define TASK "" #define ALL(x) (x).begin(), (x).end() using namespace std; template <typename T1, typename T2> bool mini(T1 &a, T2 b) { if (a > b) {a = b; return true;} return false; } template <typename T1, typename T2> bool maxi(T1 &a, T2 b) { if (a < b) {a = b; return true;} return false; } const int N = 2505; const int oo = 1e9; const long long ooo = 1e18; const int mod = 1e9 + 7; // 998244353; const long double pi = acos(-1); int a[N][N]; int n,m; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifdef ONLINE_JUDGE // freopen(TASK".inp","r",stdin); // freopen(TASK".out","w",stdout); #endif cin >> n >> m; for (int i = 1; i <= n; i++) { string str; cin >> str; for (int j = 1; j <= m; j++) a[i][j] = str[j - 1] - '0'; } int r = oo, c = oo; for (int i = 1; i <= n; i++) { int cnt = 0; for (int j = 1; j <= m; j++) { if (a[i][j] == 0) { if (cnt > 0) mini(c, cnt); cnt = 0; } else cnt++; } if (cnt > 0) mini(c, cnt); } for (int j = 1; j <= m; j++) { int cnt = 0; for (int i = 1; i <= n; i++) { if (a[i][j] == 0) { if (cnt > 0) mini(r, cnt); cnt = 0; } else cnt++; } if (cnt > 0) mini(r, cnt); } cout << r * c; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...