Submission #94314

# Submission time Handle Problem Language Result Execution time Memory
94314 2019-01-17T13:39:00 Z Kastanda Bomb (IZhO17_bomb) C++11
90 / 100
105 ms 56824 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 2505;
int n, m, Mnx, R[N], up[N][N], dn[N][N];
char A[N][N];
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
        scanf("%s", &A[i][1]);

    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
        {
            up[i][j] = i - 1;
            if (A[i - 1][j] == '1')
                up[i][j] = up[i - 1][j];
        }
    for (int i = n; i; i--)
        for (int j = 1; j <= m; j++)
        {
            dn[i][j] = i + 1;
            if (A[i + 1][j] == '1')
                dn[i][j] = dn[i + 1][j];
        }
    memset(R, 63, sizeof(R));
    for (int i = 1; i <= n; i++)
    {
        int l = 0, r = n + 1, c = 0;
        for (int j = 1; j <= m; j++)
        {
            c ++;
            if (A[i][j] == '1')
            {
                l = max(l, up[i][j]);
                r = min(r, dn[i][j]);
                R[c] = min(R[c], r - l - 1);
            }
            else
            {
                if (A[i][j - 1] == '1')
                    R[c] = 0;
                l = 0; r = n + 1; c = 0;
            }
        }
        l = 0, r = n + 1, c = 0;
        for (int j = m; j; j--)
        {
            c ++;
            if (A[i][j] == '1')
            {
                l = max(l, up[i][j]);
                r = min(r, dn[i][j]);
                R[c] = min(R[c], r - l - 1);
            }
            else
            {
                if (A[i][j + 1] == '1')
                    R[c] = 0;
                l = 0; r = n + 1; c = 0;
            }
        }
    }
    int Mx_s = 0;
    for (int i = 1; i <= m; i++)
    {
        R[i] = min(R[i], R[i - 1]);
        Mx_s = max(Mx_s, i * R[i]);
    }
    return !printf("%d", Mx_s);
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
bomb.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%s", &A[i][1]);
         ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 21 ms 26616 KB Output is correct
4 Correct 22 ms 26616 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 632 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 2 ms 508 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 2 ms 632 KB Output is correct
17 Correct 2 ms 1016 KB Output is correct
18 Correct 2 ms 1144 KB Output is correct
19 Correct 3 ms 1400 KB Output is correct
20 Correct 3 ms 1400 KB Output is correct
21 Correct 2 ms 888 KB Output is correct
22 Correct 2 ms 1144 KB Output is correct
23 Correct 3 ms 1528 KB Output is correct
24 Correct 3 ms 1272 KB Output is correct
25 Correct 3 ms 1528 KB Output is correct
26 Incorrect 3 ms 1528 KB Output isn't correct
27 Incorrect 5 ms 4088 KB Output isn't correct
28 Correct 5 ms 4216 KB Output is correct
29 Correct 6 ms 5368 KB Output is correct
30 Correct 8 ms 6392 KB Output is correct
31 Correct 6 ms 4988 KB Output is correct
32 Correct 7 ms 5880 KB Output is correct
33 Correct 7 ms 6648 KB Output is correct
34 Correct 6 ms 4728 KB Output is correct
35 Correct 8 ms 6648 KB Output is correct
36 Incorrect 8 ms 6776 KB Output isn't correct
37 Correct 2 ms 504 KB Output is correct
38 Correct 95 ms 56568 KB Output is correct
39 Correct 2 ms 632 KB Output is correct
40 Correct 21 ms 15864 KB Output is correct
41 Correct 2 ms 504 KB Output is correct
42 Correct 3 ms 1528 KB Output is correct
43 Correct 94 ms 56568 KB Output is correct
44 Correct 8 ms 6776 KB Output is correct
45 Correct 98 ms 56572 KB Output is correct
46 Correct 102 ms 56568 KB Output is correct
47 Correct 92 ms 56568 KB Output is correct
48 Correct 94 ms 56696 KB Output is correct
49 Incorrect 101 ms 56668 KB Output isn't correct
50 Correct 95 ms 56568 KB Output is correct
51 Correct 98 ms 56560 KB Output is correct
52 Correct 93 ms 56540 KB Output is correct
53 Correct 92 ms 56572 KB Output is correct
54 Correct 90 ms 56540 KB Output is correct
55 Correct 89 ms 56696 KB Output is correct
56 Correct 103 ms 56568 KB Output is correct
57 Correct 94 ms 56568 KB Output is correct
58 Correct 95 ms 56568 KB Output is correct
59 Correct 90 ms 56544 KB Output is correct
60 Incorrect 92 ms 56544 KB Output isn't correct
61 Incorrect 104 ms 56568 KB Output isn't correct
62 Incorrect 104 ms 56568 KB Output isn't correct
63 Incorrect 97 ms 56540 KB Output isn't correct
64 Incorrect 96 ms 56568 KB Output isn't correct
65 Correct 99 ms 56824 KB Output is correct
66 Correct 99 ms 56568 KB Output is correct
67 Correct 94 ms 56536 KB Output is correct
68 Correct 96 ms 56540 KB Output is correct
69 Correct 94 ms 56540 KB Output is correct
70 Correct 64 ms 45432 KB Output is correct
71 Correct 88 ms 56568 KB Output is correct
72 Correct 90 ms 56548 KB Output is correct
73 Correct 88 ms 56540 KB Output is correct
74 Correct 89 ms 56540 KB Output is correct
75 Correct 92 ms 56696 KB Output is correct
76 Correct 90 ms 56540 KB Output is correct
77 Correct 93 ms 56568 KB Output is correct
78 Correct 94 ms 56568 KB Output is correct
79 Correct 86 ms 56568 KB Output is correct
80 Correct 88 ms 56524 KB Output is correct
81 Correct 89 ms 56568 KB Output is correct
82 Correct 95 ms 56568 KB Output is correct
83 Correct 89 ms 56624 KB Output is correct
84 Correct 95 ms 56568 KB Output is correct
85 Correct 95 ms 56644 KB Output is correct
86 Correct 99 ms 56700 KB Output is correct
87 Correct 89 ms 56568 KB Output is correct
88 Correct 90 ms 56568 KB Output is correct
89 Correct 97 ms 56696 KB Output is correct
90 Correct 65 ms 45688 KB Output is correct
91 Correct 92 ms 56644 KB Output is correct
92 Correct 91 ms 56652 KB Output is correct
93 Correct 93 ms 56568 KB Output is correct
94 Correct 95 ms 56540 KB Output is correct
95 Correct 94 ms 56568 KB Output is correct
96 Correct 89 ms 56540 KB Output is correct
97 Correct 96 ms 56504 KB Output is correct
98 Correct 93 ms 56156 KB Output is correct
99 Correct 91 ms 56184 KB Output is correct
100 Correct 105 ms 56184 KB Output is correct