Submission #171583

# Submission time Handle Problem Language Result Execution time Memory
171583 2019-12-29T10:12:49 Z mcdx9524 Bomb (IZhO17_bomb) C++14
2 / 100
1000 ms 18940 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 2500 + 7;

char a[N][N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
        }
    }
    int ans = 0;
    for (int x = 1; x <= n; x++) {
        for (int y = 1; y <= m; y++) {
            char b[n + 7][m + 7];
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++) {
                    b[i][j] = a[i][j];
                }
            }
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++) {
                    if (i + x - 1 > n || j + y - 1 > m) {
                        continue;
                    }
                    bool bad = false;
                    for (int r = i; r <= i + x - 1; r++) {
                        for (int c = j; c <= j + y - 1; c++) {
                            if (b[r][c] != '1') {
                                bad = true;
                            }
                            if (bad) break;
                        }
                        if (bad) break;
                    }
                    if (bad) continue;
                    for (int r = i; r <= i + x - 1; r++) {
                        for (int c = j; c <= j + y - 1; c++) {
                            b[r][c] = '2';
                        }
                    }
                }
            }
            for (int i = n; i >= 1; i--) {
                for (int j = m; j >= 1; j--) {
                    if (i - x + 1 < 1 || j - y + 1 < 1) {
                        continue;
                    }
                    if (b[i][j] == '1') {
                        for (int r = i; r >= i - x + 1; r--) {
                            for (int c = j; c >= j - y + 1; c--) {
                                b[i][j] = '2';
                            }
                        }
                    }
                }
            }
            bool good = true;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= n; j++) {
                    if (a[i][j] == '0') {
                        continue;
                    }
                    if (a[i][j] == '1' && b[i][j] == '2') {
                        continue;
                    }
                    good = false;
                    if (!good) break;
                }
                if (!good) break;
            }
            if (good) {
                ans = max(ans, x * y);
            }
        }
    }
    cout << ans << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Execution timed out 1056 ms 6520 KB Time limit exceeded
4 Execution timed out 1075 ms 6520 KB Time limit exceeded
5 Incorrect 235 ms 504 KB Output isn't correct
6 Incorrect 16 ms 376 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 3 ms 376 KB Output isn't correct
9 Incorrect 3 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 3 ms 376 KB Output isn't correct
12 Incorrect 3 ms 380 KB Output isn't correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Correct 2 ms 376 KB Output is correct
15 Incorrect 3 ms 376 KB Output isn't correct
16 Incorrect 4 ms 376 KB Output isn't correct
17 Incorrect 137 ms 504 KB Output isn't correct
18 Incorrect 78 ms 504 KB Output isn't correct
19 Incorrect 260 ms 636 KB Output isn't correct
20 Incorrect 288 ms 632 KB Output isn't correct
21 Incorrect 82 ms 632 KB Output isn't correct
22 Correct 184 ms 504 KB Output is correct
23 Incorrect 751 ms 632 KB Output isn't correct
24 Incorrect 197 ms 504 KB Output isn't correct
25 Incorrect 984 ms 632 KB Output isn't correct
26 Execution timed out 1074 ms 632 KB Time limit exceeded
27 Execution timed out 1081 ms 1272 KB Time limit exceeded
28 Execution timed out 1077 ms 1272 KB Time limit exceeded
29 Execution timed out 1086 ms 1532 KB Time limit exceeded
30 Execution timed out 1085 ms 1784 KB Time limit exceeded
31 Execution timed out 1068 ms 1400 KB Time limit exceeded
32 Execution timed out 1079 ms 1656 KB Time limit exceeded
33 Execution timed out 1084 ms 1784 KB Time limit exceeded
34 Execution timed out 1086 ms 1400 KB Time limit exceeded
35 Execution timed out 1077 ms 1784 KB Time limit exceeded
36 Execution timed out 1069 ms 1784 KB Time limit exceeded
37 Incorrect 4 ms 376 KB Output isn't correct
38 Execution timed out 1067 ms 18656 KB Time limit exceeded
39 Incorrect 3 ms 376 KB Output isn't correct
40 Execution timed out 1083 ms 3960 KB Time limit exceeded
41 Incorrect 3 ms 376 KB Output isn't correct
42 Execution timed out 1082 ms 632 KB Time limit exceeded
43 Execution timed out 1081 ms 18680 KB Time limit exceeded
44 Execution timed out 1076 ms 1784 KB Time limit exceeded
45 Execution timed out 1082 ms 18764 KB Time limit exceeded
46 Execution timed out 1072 ms 18808 KB Time limit exceeded
47 Execution timed out 1070 ms 18824 KB Time limit exceeded
48 Execution timed out 1080 ms 18680 KB Time limit exceeded
49 Execution timed out 1085 ms 18680 KB Time limit exceeded
50 Execution timed out 1077 ms 18684 KB Time limit exceeded
51 Execution timed out 1073 ms 18652 KB Time limit exceeded
52 Execution timed out 1075 ms 18680 KB Time limit exceeded
53 Execution timed out 1071 ms 18680 KB Time limit exceeded
54 Execution timed out 1074 ms 18680 KB Time limit exceeded
55 Execution timed out 1088 ms 18680 KB Time limit exceeded
56 Execution timed out 1084 ms 18680 KB Time limit exceeded
57 Execution timed out 1082 ms 18680 KB Time limit exceeded
58 Execution timed out 1084 ms 18680 KB Time limit exceeded
59 Execution timed out 1073 ms 18712 KB Time limit exceeded
60 Execution timed out 1077 ms 18808 KB Time limit exceeded
61 Execution timed out 1079 ms 18680 KB Time limit exceeded
62 Execution timed out 1074 ms 18760 KB Time limit exceeded
63 Execution timed out 1080 ms 18680 KB Time limit exceeded
64 Execution timed out 1079 ms 18680 KB Time limit exceeded
65 Execution timed out 1075 ms 18704 KB Time limit exceeded
66 Execution timed out 1084 ms 18684 KB Time limit exceeded
67 Execution timed out 1076 ms 18680 KB Time limit exceeded
68 Execution timed out 1073 ms 18680 KB Time limit exceeded
69 Execution timed out 1080 ms 18680 KB Time limit exceeded
70 Execution timed out 1075 ms 13048 KB Time limit exceeded
71 Execution timed out 1075 ms 18732 KB Time limit exceeded
72 Execution timed out 1088 ms 18680 KB Time limit exceeded
73 Execution timed out 1060 ms 18680 KB Time limit exceeded
74 Execution timed out 1080 ms 18680 KB Time limit exceeded
75 Execution timed out 1088 ms 18680 KB Time limit exceeded
76 Execution timed out 1077 ms 18680 KB Time limit exceeded
77 Execution timed out 1079 ms 18808 KB Time limit exceeded
78 Execution timed out 1072 ms 18676 KB Time limit exceeded
79 Execution timed out 1074 ms 18680 KB Time limit exceeded
80 Execution timed out 1077 ms 18680 KB Time limit exceeded
81 Execution timed out 1076 ms 18652 KB Time limit exceeded
82 Execution timed out 1062 ms 18680 KB Time limit exceeded
83 Execution timed out 1080 ms 18764 KB Time limit exceeded
84 Execution timed out 1079 ms 18784 KB Time limit exceeded
85 Execution timed out 1071 ms 18796 KB Time limit exceeded
86 Execution timed out 1083 ms 18680 KB Time limit exceeded
87 Execution timed out 1067 ms 18680 KB Time limit exceeded
88 Execution timed out 1069 ms 18716 KB Time limit exceeded
89 Execution timed out 1072 ms 18680 KB Time limit exceeded
90 Execution timed out 1073 ms 13048 KB Time limit exceeded
91 Execution timed out 1072 ms 18940 KB Time limit exceeded
92 Execution timed out 1073 ms 18680 KB Time limit exceeded
93 Execution timed out 1078 ms 18680 KB Time limit exceeded
94 Execution timed out 1075 ms 18808 KB Time limit exceeded
95 Execution timed out 1081 ms 18680 KB Time limit exceeded
96 Execution timed out 1076 ms 18720 KB Time limit exceeded
97 Execution timed out 1084 ms 18724 KB Time limit exceeded
98 Execution timed out 1086 ms 18680 KB Time limit exceeded
99 Execution timed out 1076 ms 18680 KB Time limit exceeded
100 Execution timed out 1074 ms 18680 KB Time limit exceeded