# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
109219 | ihdignite | Bomb (IZhO17_bomb) | C++14 | 494 ms | 62328 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;
const int mxN=2500;
int n, m, mxw=mxN, mxh=mxN, u[mxN][mxN], d[mxN][mxN], a[mxN], ans;
string g[mxN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for(int i=0; i<n; ++i) {
cin >> g[i];
for(int j=0, w=0; j<m; ++j) {
w=g[i][j]&1?w+1:0;
if(w&&(j+1>=m||g[i][j+1]&1^1))
mxw=min(w, mxw);
}
}
for(int j=0; j<m; ++j) {
for(int i=0, h=0; i<n; ++i) {
h=g[i][j]&1?h+1:0;
if(h&&(i+1>=n||g[i+1][j]&1^1))
mxh=min(h, mxh);
u[i][j]=i&&g[i-1][j]&1?u[i-1][j]:i;
}
for(int i=n-1; ~i; --i)
d[i][j]=i<n-1&&g[i+1][j]&1?d[i+1][j]:i;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |