Submission #833860

# Submission time Handle Problem Language Result Execution time Memory
833860 2023-08-22T09:09:20 Z vjudge1 Bomb (IZhO17_bomb) C++14
28 / 100
1000 ms 3924 KB
#include<bits/stdc++.h>
using namespace std;

const int MAX = 450 + 5;

int n,m,x[MAX][MAX],pf[MAX][MAX],atk[MAX][MAX];
char c;

int get(int x1,int y1,int x2,int y2){
	x1--, y1--;
	return pf[x2][y2] - pf[x2][y1] - pf[x1][y2] + pf[x1][y1];
}

bool bisa(int h,int w){
	memset(atk, 0, sizeof atk);
	for(int i = h; i<=n; i++){
		for(int j = w; j<=m; j++){
			if(get(i-h+1, j-w+1, i, j) == h*w){
				atk[i-h+1][j-w+1]++;
				atk[i-h+1][j+1]--;
				atk[i+1][j-w+1]--;
				atk[i+1][j+1]++;
			}
		}
	}
	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=m; j++){
			atk[i][j] = atk[i-1][j] + atk[i][j-1] - atk[i-1][j-1] + atk[i][j];
			if(atk[i][j]){
				if(!x[i][j])return false;
			}
			else {
				if(x[i][j])return false;
			}
		}
	}
	return true;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin>>n>>m;
	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=m; j++){
			cin>>c;
			x[i][j] = (c=='1');
			pf[i][j] = pf[i-1][j] + pf[i][j-1] - pf[i-1][j-1] + x[i][j];
		}
	}
	
//	bisa(3, 1);
//	
//	for(int i = 1; i<=n; i++){
//		for(int j = 1; j<=m; j++){
//			cout<<atk[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	
	int ans = 0;
	for(int h = 1; h<=n; h++){
		for(int w = 1; w<=m; w++){
			if(bisa(h,w))ans = max(ans, w*h);
		}
	}
	
	cout<<ans<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1108 KB Output is correct
2 Correct 1 ms 1108 KB Output is correct
3 Incorrect 2 ms 2644 KB Output isn't correct
4 Incorrect 1 ms 2644 KB Output isn't correct
5 Correct 32 ms 1172 KB Output is correct
6 Correct 14 ms 1108 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 6 ms 1108 KB Output is correct
9 Correct 6 ms 1108 KB Output is correct
10 Correct 3 ms 1108 KB Output is correct
11 Correct 6 ms 1108 KB Output is correct
12 Correct 4 ms 1108 KB Output is correct
13 Correct 3 ms 1108 KB Output is correct
14 Correct 4 ms 1108 KB Output is correct
15 Correct 5 ms 1108 KB Output is correct
16 Correct 6 ms 1108 KB Output is correct
17 Correct 59 ms 1368 KB Output is correct
18 Correct 58 ms 1488 KB Output is correct
19 Correct 104 ms 1364 KB Output is correct
20 Correct 123 ms 1456 KB Output is correct
21 Correct 62 ms 1236 KB Output is correct
22 Correct 96 ms 1364 KB Output is correct
23 Correct 153 ms 1492 KB Output is correct
24 Correct 83 ms 1424 KB Output is correct
25 Correct 161 ms 1492 KB Output is correct
26 Correct 160 ms 1496 KB Output is correct
27 Execution timed out 1042 ms 2260 KB Time limit exceeded
28 Execution timed out 1066 ms 2260 KB Time limit exceeded
29 Execution timed out 1059 ms 2644 KB Time limit exceeded
30 Execution timed out 1063 ms 2772 KB Time limit exceeded
31 Execution timed out 1070 ms 2388 KB Time limit exceeded
32 Execution timed out 1049 ms 2664 KB Time limit exceeded
33 Execution timed out 1058 ms 2912 KB Time limit exceeded
34 Execution timed out 1039 ms 2388 KB Time limit exceeded
35 Execution timed out 1046 ms 2900 KB Time limit exceeded
36 Execution timed out 1047 ms 2900 KB Time limit exceeded
37 Correct 6 ms 1108 KB Output is correct
38 Incorrect 17 ms 3412 KB Output isn't correct
39 Correct 6 ms 1108 KB Output is correct
40 Incorrect 6 ms 3284 KB Output isn't correct
41 Correct 6 ms 1108 KB Output is correct
42 Correct 213 ms 1496 KB Output is correct
43 Incorrect 16 ms 2732 KB Output isn't correct
44 Execution timed out 1047 ms 2884 KB Time limit exceeded
45 Incorrect 20 ms 3532 KB Output isn't correct
46 Incorrect 17 ms 2724 KB Output isn't correct
47 Incorrect 17 ms 3548 KB Output isn't correct
48 Incorrect 16 ms 3540 KB Output isn't correct
49 Incorrect 20 ms 3532 KB Output isn't correct
50 Incorrect 18 ms 3612 KB Output isn't correct
51 Incorrect 17 ms 3664 KB Output isn't correct
52 Incorrect 19 ms 3656 KB Output isn't correct
53 Incorrect 19 ms 3644 KB Output isn't correct
54 Incorrect 17 ms 3556 KB Output isn't correct
55 Incorrect 17 ms 3660 KB Output isn't correct
56 Incorrect 16 ms 3704 KB Output isn't correct
57 Incorrect 19 ms 3776 KB Output isn't correct
58 Incorrect 17 ms 3668 KB Output isn't correct
59 Incorrect 17 ms 3868 KB Output isn't correct
60 Incorrect 18 ms 3796 KB Output isn't correct
61 Incorrect 16 ms 3796 KB Output isn't correct
62 Incorrect 21 ms 3660 KB Output isn't correct
63 Incorrect 16 ms 3840 KB Output isn't correct
64 Incorrect 19 ms 3796 KB Output isn't correct
65 Incorrect 16 ms 3776 KB Output isn't correct
66 Incorrect 18 ms 3524 KB Output isn't correct
67 Incorrect 17 ms 3644 KB Output isn't correct
68 Incorrect 21 ms 3888 KB Output isn't correct
69 Incorrect 20 ms 3880 KB Output isn't correct
70 Incorrect 16 ms 3088 KB Output isn't correct
71 Incorrect 17 ms 2864 KB Output isn't correct
72 Incorrect 16 ms 3140 KB Output isn't correct
73 Incorrect 16 ms 3096 KB Output isn't correct
74 Incorrect 15 ms 3168 KB Output isn't correct
75 Incorrect 19 ms 3144 KB Output isn't correct
76 Incorrect 16 ms 3064 KB Output isn't correct
77 Incorrect 16 ms 3080 KB Output isn't correct
78 Incorrect 15 ms 3148 KB Output isn't correct
79 Incorrect 16 ms 3124 KB Output isn't correct
80 Incorrect 20 ms 3156 KB Output isn't correct
81 Incorrect 16 ms 3120 KB Output isn't correct
82 Incorrect 15 ms 3084 KB Output isn't correct
83 Incorrect 15 ms 3100 KB Output isn't correct
84 Incorrect 16 ms 3116 KB Output isn't correct
85 Incorrect 15 ms 3144 KB Output isn't correct
86 Incorrect 17 ms 3924 KB Output isn't correct
87 Incorrect 18 ms 3120 KB Output isn't correct
88 Incorrect 15 ms 3156 KB Output isn't correct
89 Incorrect 21 ms 3148 KB Output isn't correct
90 Incorrect 15 ms 3028 KB Output isn't correct
91 Incorrect 16 ms 3116 KB Output isn't correct
92 Incorrect 16 ms 3156 KB Output isn't correct
93 Incorrect 16 ms 3924 KB Output isn't correct
94 Incorrect 16 ms 3156 KB Output isn't correct
95 Incorrect 16 ms 3144 KB Output isn't correct
96 Incorrect 17 ms 3156 KB Output isn't correct
97 Incorrect 16 ms 3924 KB Output isn't correct
98 Incorrect 16 ms 3172 KB Output isn't correct
99 Incorrect 20 ms 3172 KB Output isn't correct
100 Incorrect 16 ms 3924 KB Output isn't correct