답안 #93320

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
93320 2019-01-07T14:52:44 Z toloraia Bomb (IZhO17_bomb) C++14
41 / 100
1000 ms 57724 KB
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#pragma GCC ("O3")
using namespace std;

const int N = 2600;



int n, m;
char ch[N][N];
int A[N][N], B[N][N];

int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            cin>>ch[i][j];
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            A[i][j] = A[i - 1][j] + A[i][j - 1] - A[i - 1][j - 1] + ch[i][j] - '0';
    int J = m;
    int ans = 0;
    for (int I = 1; I <= n && J; I++){
        while (J){
            bool ok = 1;
            for (int i = 0; i <= n; i++)
                for (int j = 0; j <= m; j++)
                    B[i][j] = 0;
            for (int i = 0; i + I <= n; i++)
                for (int j = 0; j + J <= m; j++){
                    int x = A[i + I][j + J] - A[i + I][j] - A[i][j + J] + A[i][j];
                    if (x == I * J){
                        B[i + I + 1][j + J + 1]++;
                        B[i + 1][j + J + 1]--;
                        B[i + I + 1][j + 1]--;
                        B[i + 1][j + 1]++;
                    }
                }
            for (int i = 1; i <= n; i++)
                for (int j = 1; j <= m; j++)
                    B[i][j] += B[i - 1][j] + B[i][j - 1] - B[i - 1][j - 1];
            for (int i = 1; i <= n; i++)
                for (int j = 1; j <= m; j++)
                    if (ch[i][j] == '1' && B[i][j] == 0)
                        ok = 0;
            if (ok)
                break;
            J--;
        }
        ans = max (ans, I * J);
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

bomb.cpp:5:0: warning: ignoring #pragma GCC  [-Wunknown-pragmas]
 #pragma GCC ("O3")
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 30 ms 26872 KB Output is correct
4 Correct 33 ms 26744 KB Output is correct
5 Correct 35 ms 504 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 504 KB Output is correct
9 Correct 2 ms 632 KB Output is correct
10 Correct 2 ms 504 KB Output is correct
11 Correct 2 ms 552 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 504 KB Output is correct
15 Correct 2 ms 508 KB Output is correct
16 Correct 2 ms 552 KB Output is correct
17 Correct 4 ms 1016 KB Output is correct
18 Correct 4 ms 1144 KB Output is correct
19 Correct 6 ms 1400 KB Output is correct
20 Correct 7 ms 1404 KB Output is correct
21 Correct 4 ms 888 KB Output is correct
22 Correct 6 ms 1144 KB Output is correct
23 Correct 9 ms 1400 KB Output is correct
24 Correct 5 ms 1272 KB Output is correct
25 Correct 10 ms 1528 KB Output is correct
26 Correct 9 ms 1528 KB Output is correct
27 Correct 136 ms 4140 KB Output is correct
28 Correct 242 ms 4312 KB Output is correct
29 Correct 293 ms 5496 KB Output is correct
30 Correct 591 ms 6428 KB Output is correct
31 Correct 407 ms 5096 KB Output is correct
32 Correct 412 ms 5932 KB Output is correct
33 Correct 620 ms 6732 KB Output is correct
34 Correct 109 ms 4728 KB Output is correct
35 Correct 490 ms 6776 KB Output is correct
36 Correct 602 ms 6740 KB Output is correct
37 Correct 2 ms 504 KB Output is correct
38 Execution timed out 1067 ms 57592 KB Time limit exceeded
39 Correct 2 ms 504 KB Output is correct
40 Execution timed out 1068 ms 15608 KB Time limit exceeded
41 Correct 2 ms 504 KB Output is correct
42 Correct 11 ms 1528 KB Output is correct
43 Execution timed out 1087 ms 57592 KB Time limit exceeded
44 Correct 733 ms 6744 KB Output is correct
45 Execution timed out 1080 ms 57592 KB Time limit exceeded
46 Execution timed out 1073 ms 57660 KB Time limit exceeded
47 Execution timed out 1083 ms 57592 KB Time limit exceeded
48 Execution timed out 1079 ms 57592 KB Time limit exceeded
49 Execution timed out 1079 ms 57532 KB Time limit exceeded
50 Execution timed out 1077 ms 57592 KB Time limit exceeded
51 Execution timed out 1081 ms 57724 KB Time limit exceeded
52 Execution timed out 1076 ms 57592 KB Time limit exceeded
53 Execution timed out 1066 ms 57592 KB Time limit exceeded
54 Execution timed out 1069 ms 57592 KB Time limit exceeded
55 Execution timed out 1072 ms 57592 KB Time limit exceeded
56 Execution timed out 1073 ms 57592 KB Time limit exceeded
57 Execution timed out 1070 ms 57592 KB Time limit exceeded
58 Execution timed out 1079 ms 57592 KB Time limit exceeded
59 Execution timed out 1081 ms 57592 KB Time limit exceeded
60 Execution timed out 1076 ms 57564 KB Time limit exceeded
61 Execution timed out 1086 ms 57592 KB Time limit exceeded
62 Execution timed out 1081 ms 57644 KB Time limit exceeded
63 Execution timed out 1081 ms 57592 KB Time limit exceeded
64 Execution timed out 1082 ms 57592 KB Time limit exceeded
65 Execution timed out 1076 ms 57532 KB Time limit exceeded
66 Execution timed out 1085 ms 57592 KB Time limit exceeded
67 Execution timed out 1074 ms 57564 KB Time limit exceeded
68 Execution timed out 1067 ms 57640 KB Time limit exceeded
69 Execution timed out 1074 ms 57592 KB Time limit exceeded
70 Execution timed out 1082 ms 46200 KB Time limit exceeded
71 Execution timed out 1083 ms 57592 KB Time limit exceeded
72 Execution timed out 1066 ms 57564 KB Time limit exceeded
73 Execution timed out 1076 ms 57604 KB Time limit exceeded
74 Execution timed out 1045 ms 57632 KB Time limit exceeded
75 Execution timed out 1066 ms 57592 KB Time limit exceeded
76 Execution timed out 1073 ms 57648 KB Time limit exceeded
77 Execution timed out 1064 ms 57528 KB Time limit exceeded
78 Execution timed out 1082 ms 57524 KB Time limit exceeded
79 Execution timed out 1079 ms 57584 KB Time limit exceeded
80 Execution timed out 1082 ms 57564 KB Time limit exceeded
81 Execution timed out 1076 ms 57596 KB Time limit exceeded
82 Execution timed out 1084 ms 57596 KB Time limit exceeded
83 Execution timed out 1077 ms 57524 KB Time limit exceeded
84 Execution timed out 1072 ms 57636 KB Time limit exceeded
85 Execution timed out 1077 ms 57564 KB Time limit exceeded
86 Execution timed out 1080 ms 57600 KB Time limit exceeded
87 Execution timed out 1049 ms 57568 KB Time limit exceeded
88 Execution timed out 1080 ms 57632 KB Time limit exceeded
89 Execution timed out 1072 ms 57640 KB Time limit exceeded
90 Execution timed out 1070 ms 46160 KB Time limit exceeded
91 Execution timed out 1063 ms 57592 KB Time limit exceeded
92 Execution timed out 1073 ms 57568 KB Time limit exceeded
93 Execution timed out 1073 ms 57592 KB Time limit exceeded
94 Execution timed out 1052 ms 57532 KB Time limit exceeded
95 Execution timed out 1082 ms 57576 KB Time limit exceeded
96 Execution timed out 1074 ms 57592 KB Time limit exceeded
97 Execution timed out 1074 ms 57592 KB Time limit exceeded
98 Execution timed out 1084 ms 57564 KB Time limit exceeded
99 Execution timed out 1062 ms 57664 KB Time limit exceeded
100 Execution timed out 1067 ms 57636 KB Time limit exceeded