# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
883692 | Sokol080808 | Bomb (IZhO17_bomb) | C++17 | 86 ms | 12884 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.
#ifdef ONPC
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <malloc.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template<typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& p) {in >> p.first >> p.second; return in;}
template<typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2>& p) {out << p.first << ' ' << p.second; return out;}
template<typename T> istream& operator>>(istream& in, vector<T>& v) {for (auto& x : v) in >> x; return in;}
template<typename T> ostream& operator<<(ostream& out, vector<T>& v) {for (auto& x : v) out << x << ' '; return out;}
template<typename T> ostream& operator<<(ostream& out, set<T>& v) {for (auto& x : v) out << x << ' '; return out;}
template<typename T> ostream& operator<<(ostream& out, multiset<T>& v) {for (auto& x : v) out << x << ' '; return out;}
const int MAX_INT = 2147483647;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<vector<char>> f(n, vector<char>(m));
for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> f[i][j];
int mx_x = 1e9;
for (int i = 0; i < n; i++) {
int mn = 1e9;
int cur = 0;
for (int j = 0; j < m; j++) {
if (f[i][j] == '1') cur++;
if (f[i][j] == '0' || j + 1 == m) {
if (cur != 0) mn = min(mn, cur);
cur = 0;
}
}
mx_x = min(mx_x, mn);
}
int mx_y = 1e9;
for (int j = 0; j < m; j++) {
int mn = 1e9;
int cur = 0;
for (int i = 0; i < n; i++) {
if (f[i][j] == '1') cur++;
if (f[i][j] == '0' || i + 1 == n) {
if (cur != 0) mn = min(mn, cur);
cur = 0;
}
}
mx_y = min(mx_y, mn);
}
cout << 1LL * mx_x * mx_y << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |