답안 #38384

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38384 2018-01-04T04:44:26 Z Talant Bomb (IZhO17_bomb) C++14
23 / 100
1000 ms 56992 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e6 + 10;

int n,m;
char a[2501][2501];
int t[2501][2501];
int c[2501][2501];
int mx;

bool check (int h,int w) {
        for (int i = h; i <= n; i ++) {
                for (int j = w; j <= m; j ++) {
                        if (c[i][j] - c[i - h][j] - c[i][j - w] + c[i - h][j - w] == (h * w)) {
                                for (int l = i - h + 1; l <= i; l ++) {
                                        for (int r = j - w + 1; r <= j; r ++) {
                                                t[l][r] = -1;
                                        }
                                }
                        }
                }
        }
        int f = 0;
        for (int i = 1; i <= n; i ++) {
                for (int j = 1; j <= n; j ++) {
                        if (t[i][j] == 1)
                                f = 1;
                        if (t[i][j] == -1)
                                t[i][j] = 1;
                }
        }
        if (f)
                return false;
        return true;
}
int main () {
        cin >> 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 ++) {
                        t[i][j] = int(a[i][j] - '0');
                        c[i][j] = t[i][j];
                }
        }
        for (int i = 1; i <= n; i ++)
                for (int j = 2; j <= m; j ++)
                        c[i][j] += c[i][j - 1];

        for (int i = 2; i <= n; i ++)
                for (int j = 1; j <= m; j ++)
                        c[i][j] += c[i - 1][j];

        for (int i = 1; i <= n; i ++) {
                for (int j = 1; j <= m; j ++) {
                         if (check(i,j))
                                mx = max(mx,i * j);
                }
        }
        cout << mx << endl;
}

Compilation message

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