# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107729 | Shafin666 | Bomb (IZhO17_bomb) | C++14 | 476 ms | 12792 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 mp make_pair
#define pb push_back
#define pii pair<int, int>
#define read_input freopen("in.txt","r", stdin)
#define print_output freopen("out.txt","w", stdout)
typedef long long ll;
typedef long double ld;
using namespace std;
int main()
{
int n, m;
char grid[2505][2505];
cin >> n >> m;
int w = 1e9+7, h = 1e9+7;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++) {
cin >> grid[i][j];
}
}
for(int i = 1; i <= n; i++) {
int len = 0;
for(int j = 1; j <= m; j++) {
if(grid[i][j] == '1') len += 1;
else {
if(len) w = min(w, len);
len = 0;
}
}
if(len) w = min(w, len);
}
for(int i = 1; i <= m; i++) {
int len = 0;
for(int j = 1; j <= n; j++) {
if(grid[j][i] == '1') len += 1;
else {
if(len) h = min(h, len);
len = 0;
}
}
if(len) h = min(h, len);
}
cout << w * h << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |