# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1106803 | stdfloat | Bomb (IZhO17_bomb) | C++17 | 1097 ms | 8368 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>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<string> a(n);
for (auto &i : a)
cin >> i;
int mx = 1;
for (int x = 1; x <= n; x++) {
for (int y = 1; y <= m; y++) {
if (x * y <= mx) continue;
vector<vector<bool>> vis(n, vector<bool>(m));
for (int i = 0; i + x <= n; i++) {
for (int j = 0; j + y <= m; j++) {
if (a[i][j] == '0') continue;
bool tr = true;
for (int k = i; k < i + x && tr; k++) {
for (int l = j; l < j + y && tr; l++)
tr = (a[k][l] == '1');
}
if (!tr) continue;
for (int k = i; k < i + x; k++) {
for (int l = j; l < j + y; l++)
vis[k][l] = true;
}
}
}
bool tr = true;
for (int i = 0; i < n && tr; i++) {
for (int j = 0; j < m && tr; j++)
tr = (a[i][j] == '0' || vis[i][j]);
}
if (tr) mx = max(mx, x * y);
}
}
cout << mx;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |