Submission #377314

#TimeUsernameProblemLanguageResultExecution timeMemory
377314ijxjdjdBomb (IZhO17_bomb)C++14
24 / 100
160 ms12908 KiB
#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 timeMemoryGrader output
Fetching results...