# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91717 | popovicirobert | Bomb (IZhO17_bomb) | C++14 | 51 ms | 12764 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 lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define ld long double
// 217
// 44
using namespace std;
const int MAXN = 2505;
char mat[MAXN + 1][MAXN + 1];
int main() {
//ifstream cin("A.in");
//ofstream cout("A.out");
int i, j, n, m;
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> m;
int l = n, c = m;
for(i = 1; i <= n; i++) {
cin >> mat[i] + 1;
for(j = 1; j <= m; j++) {
mat[i][j] -= '0';
}
int cur = 0;
for(j = 1; j <= m; j++) {
cur = (cur + 1) * mat[i][j];
if(mat[i][j] == 1 && mat[i][j + 1] == 0) {
c = min(c, cur);
}
}
}
for(j = 1; j <= m; j++) {
int cur = 0;
for(i = 1; i <= n; i++) {
cur = (cur + 1) * mat[i][j];
if(mat[i][j] && mat[i + 1][j] == 0) {
l = min(l, cur);
}
}
}
cout << l * c;
//cin.close();
//cout.close();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |