# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
556093 | ngpin04 | Bomb (IZhO17_bomb) | C++14 | 88 ms | 31240 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>
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |