# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377314 | ijxjdjd | Bomb (IZhO17_bomb) | C++14 | 160 ms | 12908 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 FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
const int MAXN = 2500 + 5;
bool board[MAXN][MAXN];
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int N, M;
cin >> N >> M;
FR(i, N) {
FR(j, M) {
char c;
cin >> c;
board[i][j] = (c == '1');
}
}
int mincol = M;
FR(i, N) {
int cur = 0;
FR(j, M) {
if (board[i][j]) {
cur++;
}
else {
if (cur > 0) {
mincol = min(cur, mincol);
cur = 0;
}
}
}
if (cur > 0) {
mincol = min(cur, mincol);
}
}
int minrow = N;
FR(j, M) {
int cur = 0;
FR(i, N) {
if (board[i][j]) {
cur++;
}
else {
if (cur > 0) {
minrow = min(cur, minrow);
cur = 0;
}
}
}
if (cur > 0) {
minrow = min(cur, minrow);
}
}
cout << minrow*mincol << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |