Submission #170167

# Submission time Handle Problem Language Result Execution time Memory
170167 2019-12-24T06:39:40 Z dxz05 Bomb (IZhO17_bomb) C++14
11 / 100
229 ms 61092 KB
#include <bits/stdc++.h>

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1e9;
const int MOD = 1000000007;
const int N = 2002055;
const int M = 2511;

char a[M][M];

int dpx[M][M], dpy[M][M];
void solve() {
    int n, m;
    cin >> n >> m;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
            if (a[i][j] == '1'){
                dpx[i][j] = 1;
                dpy[i][j] = 1;
            }
        }
    }

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[i][j] == '0') continue;
            if (a[i][j-1] == '1') dpx[i][j] = dpx[i][j-1]+1;
            if (a[i-1][j] == '1') dpy[i][j] = dpy[i-1][j]+1;
        }
    }

    for (int i = n; i >= 1; i--){
        for (int j = m; j >= 1; j--){
            dpx[i][j] = max(dpx[i][j], dpx[i][j+1]);
            dpy[i][j] = max(dpy[i][j], dpy[i+1][j]);
        }
    }

    int A = INF, B = INF;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            if (a[i][j] == '0') continue;
            A = min(A, dpx[i][j]);
            B = min(B, dpy[i][j]);
        }
    }

    cout << A*B;

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 504 KB Output isn't correct
3 Correct 21 ms 26616 KB Output is correct
4 Incorrect 22 ms 26616 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 2 ms 632 KB Output isn't correct
9 Incorrect 2 ms 632 KB Output isn't correct
10 Incorrect 2 ms 504 KB Output isn't correct
11 Incorrect 2 ms 632 KB Output isn't correct
12 Incorrect 2 ms 504 KB Output isn't correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Incorrect 2 ms 504 KB Output isn't correct
16 Correct 2 ms 504 KB Output is correct
17 Correct 3 ms 1016 KB Output is correct
18 Incorrect 3 ms 1148 KB Output isn't correct
19 Incorrect 3 ms 1400 KB Output isn't correct
20 Incorrect 3 ms 1404 KB Output isn't correct
21 Incorrect 3 ms 1016 KB Output isn't correct
22 Incorrect 3 ms 1144 KB Output isn't correct
23 Incorrect 3 ms 1528 KB Output isn't correct
24 Incorrect 3 ms 1272 KB Output isn't correct
25 Incorrect 3 ms 1528 KB Output isn't correct
26 Incorrect 3 ms 1528 KB Output isn't correct
27 Incorrect 7 ms 4220 KB Output isn't correct
28 Incorrect 9 ms 4344 KB Output isn't correct
29 Incorrect 9 ms 5624 KB Output isn't correct
30 Incorrect 12 ms 6520 KB Output isn't correct
31 Incorrect 10 ms 5240 KB Output isn't correct
32 Incorrect 11 ms 6008 KB Output isn't correct
33 Incorrect 13 ms 6904 KB Output isn't correct
34 Incorrect 9 ms 4900 KB Output isn't correct
35 Incorrect 13 ms 6876 KB Output isn't correct
36 Incorrect 13 ms 6904 KB Output isn't correct
37 Incorrect 2 ms 632 KB Output isn't correct
38 Correct 217 ms 57560 KB Output is correct
39 Incorrect 2 ms 504 KB Output isn't correct
40 Incorrect 36 ms 16376 KB Output isn't correct
41 Incorrect 2 ms 504 KB Output isn't correct
42 Incorrect 3 ms 1528 KB Output isn't correct
43 Correct 213 ms 57464 KB Output is correct
44 Incorrect 13 ms 6904 KB Output isn't correct
45 Incorrect 213 ms 57436 KB Output isn't correct
46 Correct 226 ms 57592 KB Output is correct
47 Incorrect 213 ms 57464 KB Output isn't correct
48 Incorrect 211 ms 57464 KB Output isn't correct
49 Incorrect 218 ms 57592 KB Output isn't correct
50 Incorrect 223 ms 57692 KB Output isn't correct
51 Incorrect 212 ms 57484 KB Output isn't correct
52 Incorrect 213 ms 57464 KB Output isn't correct
53 Incorrect 212 ms 57464 KB Output isn't correct
54 Incorrect 216 ms 57576 KB Output isn't correct
55 Incorrect 214 ms 57456 KB Output isn't correct
56 Correct 229 ms 57464 KB Output is correct
57 Incorrect 211 ms 57336 KB Output isn't correct
58 Incorrect 211 ms 57404 KB Output isn't correct
59 Incorrect 216 ms 57464 KB Output isn't correct
60 Incorrect 226 ms 57464 KB Output isn't correct
61 Incorrect 221 ms 57468 KB Output isn't correct
62 Incorrect 219 ms 57540 KB Output isn't correct
63 Incorrect 222 ms 57464 KB Output isn't correct
64 Incorrect 227 ms 57464 KB Output isn't correct
65 Incorrect 212 ms 57464 KB Output isn't correct
66 Incorrect 213 ms 57504 KB Output isn't correct
67 Incorrect 215 ms 57336 KB Output isn't correct
68 Incorrect 216 ms 57464 KB Output isn't correct
69 Incorrect 212 ms 57484 KB Output isn't correct
70 Incorrect 148 ms 46328 KB Output isn't correct
71 Incorrect 214 ms 57464 KB Output isn't correct
72 Incorrect 213 ms 57468 KB Output isn't correct
73 Incorrect 214 ms 57628 KB Output isn't correct
74 Incorrect 219 ms 57444 KB Output isn't correct
75 Incorrect 214 ms 57564 KB Output isn't correct
76 Incorrect 215 ms 57580 KB Output isn't correct
77 Incorrect 213 ms 58232 KB Output isn't correct
78 Incorrect 213 ms 58940 KB Output isn't correct
79 Incorrect 215 ms 59544 KB Output isn't correct
80 Incorrect 215 ms 58996 KB Output isn't correct
81 Incorrect 217 ms 60924 KB Output isn't correct
82 Incorrect 213 ms 60792 KB Output isn't correct
83 Incorrect 217 ms 61092 KB Output isn't correct
84 Incorrect 217 ms 60804 KB Output isn't correct
85 Incorrect 214 ms 59652 KB Output isn't correct
86 Incorrect 221 ms 61080 KB Output isn't correct
87 Incorrect 212 ms 60804 KB Output isn't correct
88 Incorrect 214 ms 60920 KB Output isn't correct
89 Incorrect 213 ms 61072 KB Output isn't correct
90 Incorrect 146 ms 48564 KB Output isn't correct
91 Incorrect 213 ms 60920 KB Output isn't correct
92 Incorrect 216 ms 60812 KB Output isn't correct
93 Incorrect 218 ms 60948 KB Output isn't correct
94 Incorrect 214 ms 60924 KB Output isn't correct
95 Incorrect 214 ms 60792 KB Output isn't correct
96 Incorrect 216 ms 61020 KB Output isn't correct
97 Incorrect 216 ms 60892 KB Output isn't correct
98 Incorrect 212 ms 60920 KB Output isn't correct
99 Incorrect 213 ms 60792 KB Output isn't correct
100 Incorrect 221 ms 61048 KB Output isn't correct