답안 #93323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
93323 2019-01-07T14:56:39 Z toloraia Bomb (IZhO17_bomb) C++14
41 / 100
1000 ms 57792 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 && n * J >= ans; 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 31 ms 26744 KB Output is correct
4 Correct 33 ms 26840 KB Output is correct
5 Correct 35 ms 376 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 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 504 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 504 KB Output is correct
16 Correct 2 ms 632 KB Output is correct
17 Correct 4 ms 1012 KB Output is correct
18 Correct 4 ms 1144 KB Output is correct
19 Correct 7 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 8 ms 1528 KB Output is correct
24 Correct 6 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 135 ms 4140 KB Output is correct
28 Correct 226 ms 4316 KB Output is correct
29 Correct 299 ms 5496 KB Output is correct
30 Correct 547 ms 6424 KB Output is correct
31 Correct 377 ms 4984 KB Output is correct
32 Correct 411 ms 5880 KB Output is correct
33 Correct 507 ms 6648 KB Output is correct
34 Correct 102 ms 4728 KB Output is correct
35 Correct 471 ms 6736 KB Output is correct
36 Correct 610 ms 6824 KB Output is correct
37 Correct 2 ms 504 KB Output is correct
38 Execution timed out 1072 ms 57592 KB Time limit exceeded
39 Correct 2 ms 504 KB Output is correct
40 Execution timed out 1075 ms 15608 KB Time limit exceeded
41 Correct 2 ms 504 KB Output is correct
42 Correct 10 ms 1528 KB Output is correct
43 Execution timed out 1070 ms 57628 KB Time limit exceeded
44 Correct 672 ms 6776 KB Output is correct
45 Execution timed out 1091 ms 57592 KB Time limit exceeded
46 Execution timed out 1080 ms 57552 KB Time limit exceeded
47 Execution timed out 1084 ms 57592 KB Time limit exceeded
48 Execution timed out 1087 ms 57592 KB Time limit exceeded
49 Execution timed out 1080 ms 57600 KB Time limit exceeded
50 Execution timed out 1076 ms 57616 KB Time limit exceeded
51 Execution timed out 1076 ms 57640 KB Time limit exceeded
52 Execution timed out 1064 ms 57604 KB Time limit exceeded
53 Execution timed out 1080 ms 57592 KB Time limit exceeded
54 Execution timed out 1079 ms 57592 KB Time limit exceeded
55 Execution timed out 1085 ms 57592 KB Time limit exceeded
56 Execution timed out 1072 ms 57664 KB Time limit exceeded
57 Execution timed out 1077 ms 57592 KB Time limit exceeded
58 Execution timed out 1086 ms 57592 KB Time limit exceeded
59 Execution timed out 1080 ms 57592 KB Time limit exceeded
60 Execution timed out 1074 ms 57592 KB Time limit exceeded
61 Execution timed out 1075 ms 57708 KB Time limit exceeded
62 Execution timed out 1074 ms 57656 KB Time limit exceeded
63 Execution timed out 1076 ms 57592 KB Time limit exceeded
64 Execution timed out 1087 ms 57592 KB Time limit exceeded
65 Execution timed out 1075 ms 57584 KB Time limit exceeded
66 Execution timed out 1078 ms 57592 KB Time limit exceeded
67 Execution timed out 1053 ms 57592 KB Time limit exceeded
68 Execution timed out 1082 ms 57524 KB Time limit exceeded
69 Execution timed out 1076 ms 57564 KB Time limit exceeded
70 Execution timed out 1066 ms 46184 KB Time limit exceeded
71 Execution timed out 1064 ms 57596 KB Time limit exceeded
72 Execution timed out 1052 ms 57616 KB Time limit exceeded
73 Execution timed out 1087 ms 57564 KB Time limit exceeded
74 Execution timed out 1093 ms 57592 KB Time limit exceeded
75 Execution timed out 1082 ms 57592 KB Time limit exceeded
76 Execution timed out 1085 ms 57792 KB Time limit exceeded
77 Execution timed out 1087 ms 57592 KB Time limit exceeded
78 Execution timed out 1071 ms 57720 KB Time limit exceeded
79 Execution timed out 1089 ms 57592 KB Time limit exceeded
80 Execution timed out 1084 ms 57592 KB Time limit exceeded
81 Execution timed out 1086 ms 57592 KB Time limit exceeded
82 Execution timed out 1079 ms 57564 KB Time limit exceeded
83 Execution timed out 1079 ms 57592 KB Time limit exceeded
84 Execution timed out 1087 ms 57592 KB Time limit exceeded
85 Execution timed out 1078 ms 57564 KB Time limit exceeded
86 Execution timed out 1083 ms 57720 KB Time limit exceeded
87 Execution timed out 1086 ms 57620 KB Time limit exceeded
88 Execution timed out 1070 ms 57592 KB Time limit exceeded
89 Execution timed out 1095 ms 57592 KB Time limit exceeded
90 Execution timed out 1082 ms 46200 KB Time limit exceeded
91 Execution timed out 1088 ms 57720 KB Time limit exceeded
92 Execution timed out 1088 ms 57592 KB Time limit exceeded
93 Execution timed out 1087 ms 57572 KB Time limit exceeded
94 Execution timed out 1085 ms 57756 KB Time limit exceeded
95 Execution timed out 1079 ms 57592 KB Time limit exceeded
96 Execution timed out 1082 ms 57720 KB Time limit exceeded
97 Execution timed out 1088 ms 57568 KB Time limit exceeded
98 Execution timed out 1082 ms 57592 KB Time limit exceeded
99 Execution timed out 1089 ms 57588 KB Time limit exceeded
100 Execution timed out 1076 ms 57592 KB Time limit exceeded