답안 #38423

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38423 2018-01-04T05:37:33 Z Just_Solve_The_Problem Bomb (IZhO17_bomb) C++11
3 / 100
1000 ms 14272 KB
#include <bits/stdc++.h>

using namespace std;

const int N = (int)2505;

char c[N][N];
char ex[N][N];

main () {
//        #define NAME "bomb"
//    freopen(NAME".in", "r", stdin);
//    freopen(NAME".out", "w", stdout);
    int n, m; scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            char ss; ss = getchar();
            if (ss == '\n')
                j--;
            else {
                c[i][j] = ss;
            }
        }
    }
    int ans = 0;
    for (int h = 1; h <= n; h++) {
        for (int w = 1; w <= m; w++) {
            for (int i = 1; i <= n; i++)
                for (int j = 1; j <= m; j++)
                    ex[i][j] = c[i][j];

            bool can = 1;
            for (int i = 1; i <= n - h + 1; i++) {
                for (int j = 1; j <= m - w + 1; j++) {
                    can = 1;
                    for (int curi = i, k = 0; k < h && curi <= n; k++, curi++) {
                        for (int curj = j, l = 0; l < w && curj <= m; l++, curj++) {
                            if (ex[curi][curj] == '0') {
                                can = 0;
                                l = w; k = h;
                            }
                        }
                    }
                    if (can) {
                        for (int curi = i, k = 0; k < h && curi <= n; k++, curi++) {
                            for (int curj = j, l = 0; l < w && curj <= m; l++, curj++) {
                                if (ex[curi][curj] == '1')
                                    ex[curi][curj] = '2';
                            }
                        }
                    }
                }
            }
            can = 1;
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= m; j++) {
                    if (ex[i][j] == '1') can = 0;
                }
            }
            if (can) ans = max(ans, h * w);
            else break;
        }
    }
    cout << ans;
}

Compilation message

bomb.cpp:10:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
bomb.cpp: In function 'int main()':
bomb.cpp:14:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n, m; scanf ("%d %d", &n, &m);
                                      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 14272 KB Output is correct
2 Incorrect 0 ms 14272 KB Output isn't correct
3 Execution timed out 1000 ms 14272 KB Execution timed out
4 Execution timed out 1000 ms 14272 KB Execution timed out
5 Correct 0 ms 14272 KB Output is correct
6 Incorrect 3 ms 14272 KB Output isn't correct
7 Correct 0 ms 14272 KB Output is correct
8 Incorrect 0 ms 14272 KB Output isn't correct
9 Incorrect 0 ms 14272 KB Output isn't correct
10 Incorrect 0 ms 14272 KB Output isn't correct
11 Incorrect 0 ms 14272 KB Output isn't correct
12 Incorrect 0 ms 14272 KB Output isn't correct
13 Incorrect 0 ms 14272 KB Output isn't correct
14 Incorrect 0 ms 14272 KB Output isn't correct
15 Incorrect 0 ms 14272 KB Output isn't correct
16 Incorrect 0 ms 14272 KB Output isn't correct
17 Incorrect 0 ms 14272 KB Output isn't correct
18 Incorrect 0 ms 14272 KB Output isn't correct
19 Incorrect 6 ms 14272 KB Output isn't correct
20 Incorrect 6 ms 14272 KB Output isn't correct
21 Incorrect 0 ms 14272 KB Output isn't correct
22 Incorrect 3 ms 14272 KB Output isn't correct
23 Incorrect 13 ms 14272 KB Output isn't correct
24 Incorrect 3 ms 14272 KB Output isn't correct
25 Incorrect 13 ms 14272 KB Output isn't correct
26 Incorrect 516 ms 14272 KB Output isn't correct
27 Execution timed out 1000 ms 14272 KB Execution timed out
28 Incorrect 129 ms 14272 KB Output isn't correct
29 Execution timed out 1000 ms 14272 KB Execution timed out
30 Execution timed out 1000 ms 14272 KB Execution timed out
31 Incorrect 906 ms 14272 KB Output isn't correct
32 Incorrect 789 ms 14272 KB Output isn't correct
33 Execution timed out 1000 ms 14272 KB Execution timed out
34 Incorrect 126 ms 14272 KB Output isn't correct
35 Incorrect 603 ms 14272 KB Output isn't correct
36 Execution timed out 1000 ms 14272 KB Execution timed out
37 Incorrect 0 ms 14272 KB Output isn't correct
38 Execution timed out 1000 ms 14272 KB Execution timed out
39 Incorrect 0 ms 14272 KB Output isn't correct
40 Execution timed out 1000 ms 14272 KB Execution timed out
41 Incorrect 0 ms 14272 KB Output isn't correct
42 Incorrect 49 ms 14272 KB Output isn't correct
43 Execution timed out 1000 ms 14272 KB Execution timed out
44 Execution timed out 1000 ms 14272 KB Execution timed out
45 Execution timed out 1000 ms 14272 KB Execution timed out
46 Execution timed out 1000 ms 14272 KB Execution timed out
47 Execution timed out 1000 ms 14272 KB Execution timed out
48 Execution timed out 1000 ms 14272 KB Execution timed out
49 Execution timed out 1000 ms 14272 KB Execution timed out
50 Execution timed out 1000 ms 14272 KB Execution timed out
51 Execution timed out 1000 ms 14272 KB Execution timed out
52 Execution timed out 1000 ms 14272 KB Execution timed out
53 Execution timed out 1000 ms 14272 KB Execution timed out
54 Execution timed out 1000 ms 14272 KB Execution timed out
55 Execution timed out 1000 ms 14272 KB Execution timed out
56 Execution timed out 1000 ms 14272 KB Execution timed out
57 Execution timed out 1000 ms 14272 KB Execution timed out
58 Execution timed out 1000 ms 14272 KB Execution timed out
59 Execution timed out 1000 ms 14272 KB Execution timed out
60 Execution timed out 1000 ms 14272 KB Execution timed out
61 Execution timed out 1000 ms 14272 KB Execution timed out
62 Execution timed out 1000 ms 14272 KB Execution timed out
63 Execution timed out 1000 ms 14272 KB Execution timed out
64 Execution timed out 1000 ms 14272 KB Execution timed out
65 Execution timed out 1000 ms 14272 KB Execution timed out
66 Execution timed out 1000 ms 14272 KB Execution timed out
67 Execution timed out 1000 ms 14272 KB Execution timed out
68 Execution timed out 1000 ms 14272 KB Execution timed out
69 Execution timed out 1000 ms 14272 KB Execution timed out
70 Execution timed out 1000 ms 14272 KB Execution timed out
71 Execution timed out 1000 ms 14272 KB Execution timed out
72 Execution timed out 1000 ms 14272 KB Execution timed out
73 Execution timed out 1000 ms 14272 KB Execution timed out
74 Execution timed out 1000 ms 14272 KB Execution timed out
75 Execution timed out 1000 ms 14272 KB Execution timed out
76 Execution timed out 1000 ms 14272 KB Execution timed out
77 Execution timed out 1000 ms 14272 KB Execution timed out
78 Execution timed out 1000 ms 14272 KB Execution timed out
79 Execution timed out 1000 ms 14272 KB Execution timed out
80 Execution timed out 1000 ms 14272 KB Execution timed out
81 Execution timed out 1000 ms 14272 KB Execution timed out
82 Execution timed out 1000 ms 14272 KB Execution timed out
83 Execution timed out 1000 ms 14272 KB Execution timed out
84 Execution timed out 1000 ms 14272 KB Execution timed out
85 Execution timed out 1000 ms 14272 KB Execution timed out
86 Execution timed out 1000 ms 14272 KB Execution timed out
87 Execution timed out 1000 ms 14272 KB Execution timed out
88 Execution timed out 1000 ms 14272 KB Execution timed out
89 Execution timed out 1000 ms 14272 KB Execution timed out
90 Execution timed out 1000 ms 14272 KB Execution timed out
91 Execution timed out 1000 ms 14272 KB Execution timed out
92 Execution timed out 1000 ms 14272 KB Execution timed out
93 Execution timed out 1000 ms 14272 KB Execution timed out
94 Execution timed out 1000 ms 14272 KB Execution timed out
95 Execution timed out 1000 ms 14272 KB Execution timed out
96 Execution timed out 1000 ms 14272 KB Execution timed out
97 Execution timed out 1000 ms 14272 KB Execution timed out
98 Execution timed out 1000 ms 14272 KB Execution timed out
99 Execution timed out 1000 ms 14272 KB Execution timed out
100 Execution timed out 1000 ms 14272 KB Execution timed out