Submission #833545

# Submission time Handle Problem Language Result Execution time Memory
833545 2023-08-22T06:45:47 Z vjudge1 Bomb (IZhO17_bomb) C++11
0 / 100
144 ms 37868 KB
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int n, m;
char g[2505][2505];
char a[2505][2505];
char v[2505][2505];

void cpy(){
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			a[i][j] = g[i][j];
			v[i][j] = 0;
		}
	}
}

bool val(int x, int y, int h, int w){
	for(int i=x; i<=min(x+h-1, n); i++){
		for(int j=y; j<=min(y+w-1, m); j++){
			if(a[i][j] == '0') return false;
		}
	}
	return true;
}

bool fil(int x, int y, int h, int w){
	for(int i=x; i<=min(x+h-1, n); i++){
		for(int j=y; j<=min(y+w-1, m); j++){
			a[i][j] = '0';
		}
	}
}


bool chk(int h, int w){
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(a[i][j] == '1'){
				v[i][j] = val(i, j, h, w);
			}
		}
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(v[i][j]){
				fil(i, j, h, w);
			}
		}
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(a[i][j] == '1') return false;
		}
	}
	return true;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>m;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			cin>>g[i][j];
		}
	}
	int mx = 1;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			cpy();
			bool ok = chk(i, j);
			if(ok) mx = max(mx, i*j);
		}
	}
	cout<<mx<<endl;
	return 0;
}

Compilation message

bomb.cpp: In function 'bool fil(int, int, int, int)':
bomb.cpp:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 25300 KB Execution killed with signal 11
2 Runtime error 17 ms 25388 KB Execution killed with signal 11
3 Runtime error 29 ms 37716 KB Execution killed with signal 11
4 Runtime error 27 ms 37692 KB Execution killed with signal 11
5 Runtime error 20 ms 25296 KB Execution killed with signal 11
6 Runtime error 18 ms 25300 KB Execution killed with signal 11
7 Runtime error 19 ms 25316 KB Execution killed with signal 11
8 Runtime error 16 ms 25428 KB Execution killed with signal 11
9 Runtime error 20 ms 25428 KB Execution killed with signal 11
10 Runtime error 16 ms 25336 KB Execution killed with signal 11
11 Runtime error 17 ms 25432 KB Execution killed with signal 11
12 Runtime error 16 ms 25428 KB Execution killed with signal 11
13 Runtime error 16 ms 25428 KB Execution killed with signal 11
14 Runtime error 16 ms 25428 KB Execution killed with signal 11
15 Runtime error 16 ms 25428 KB Execution killed with signal 11
16 Runtime error 16 ms 25428 KB Execution killed with signal 11
17 Runtime error 16 ms 25704 KB Execution killed with signal 11
18 Runtime error 17 ms 25684 KB Execution killed with signal 11
19 Runtime error 17 ms 25812 KB Execution killed with signal 11
20 Runtime error 16 ms 25812 KB Execution killed with signal 11
21 Runtime error 16 ms 25556 KB Execution killed with signal 11
22 Runtime error 18 ms 25684 KB Execution killed with signal 11
23 Runtime error 16 ms 25812 KB Execution killed with signal 11
24 Runtime error 16 ms 25684 KB Execution killed with signal 11
25 Runtime error 16 ms 25812 KB Execution killed with signal 11
26 Runtime error 17 ms 25812 KB Execution killed with signal 11
27 Runtime error 17 ms 26836 KB Execution killed with signal 11
28 Runtime error 18 ms 26708 KB Execution killed with signal 11
29 Runtime error 19 ms 27220 KB Execution killed with signal 11
30 Runtime error 20 ms 27476 KB Execution killed with signal 11
31 Runtime error 19 ms 27028 KB Execution killed with signal 11
32 Runtime error 19 ms 27348 KB Execution killed with signal 11
33 Runtime error 18 ms 27604 KB Execution killed with signal 11
34 Runtime error 27 ms 27060 KB Execution killed with signal 11
35 Runtime error 24 ms 27552 KB Execution killed with signal 11
36 Runtime error 18 ms 27604 KB Execution killed with signal 11
37 Runtime error 15 ms 25428 KB Execution killed with signal 11
38 Runtime error 102 ms 37692 KB Execution killed with signal 11
39 Runtime error 18 ms 25448 KB Execution killed with signal 11
40 Runtime error 28 ms 29600 KB Execution killed with signal 11
41 Runtime error 16 ms 25428 KB Execution killed with signal 11
42 Runtime error 14 ms 25812 KB Execution killed with signal 11
43 Runtime error 91 ms 37736 KB Execution killed with signal 11
44 Runtime error 26 ms 27624 KB Execution killed with signal 11
45 Runtime error 88 ms 37732 KB Execution killed with signal 11
46 Runtime error 98 ms 37768 KB Execution killed with signal 11
47 Runtime error 87 ms 37756 KB Execution killed with signal 11
48 Runtime error 89 ms 37704 KB Execution killed with signal 11
49 Runtime error 96 ms 37724 KB Execution killed with signal 11
50 Runtime error 87 ms 37740 KB Execution killed with signal 11
51 Runtime error 88 ms 37676 KB Execution killed with signal 11
52 Runtime error 91 ms 37756 KB Execution killed with signal 11
53 Runtime error 91 ms 37704 KB Execution killed with signal 11
54 Runtime error 102 ms 37732 KB Execution killed with signal 11
55 Runtime error 103 ms 37728 KB Execution killed with signal 11
56 Runtime error 95 ms 37792 KB Execution killed with signal 11
57 Runtime error 86 ms 37708 KB Execution killed with signal 11
58 Runtime error 82 ms 37708 KB Execution killed with signal 11
59 Runtime error 83 ms 37672 KB Execution killed with signal 11
60 Runtime error 95 ms 37732 KB Execution killed with signal 11
61 Runtime error 97 ms 37708 KB Execution killed with signal 11
62 Runtime error 102 ms 37668 KB Execution killed with signal 11
63 Runtime error 126 ms 37648 KB Execution killed with signal 11
64 Runtime error 86 ms 37772 KB Execution killed with signal 11
65 Runtime error 88 ms 37768 KB Execution killed with signal 11
66 Runtime error 96 ms 37708 KB Execution killed with signal 11
67 Runtime error 90 ms 37700 KB Execution killed with signal 11
68 Runtime error 89 ms 37708 KB Execution killed with signal 11
69 Runtime error 87 ms 37772 KB Execution killed with signal 11
70 Runtime error 59 ms 35272 KB Execution killed with signal 11
71 Runtime error 82 ms 37712 KB Execution killed with signal 11
72 Runtime error 144 ms 37712 KB Execution killed with signal 11
73 Runtime error 85 ms 37708 KB Execution killed with signal 11
74 Runtime error 84 ms 37764 KB Execution killed with signal 11
75 Runtime error 84 ms 37700 KB Execution killed with signal 11
76 Runtime error 109 ms 37692 KB Execution killed with signal 11
77 Runtime error 111 ms 37768 KB Execution killed with signal 11
78 Runtime error 84 ms 37764 KB Execution killed with signal 11
79 Runtime error 121 ms 37748 KB Execution killed with signal 11
80 Runtime error 81 ms 37708 KB Execution killed with signal 11
81 Runtime error 82 ms 37688 KB Execution killed with signal 11
82 Runtime error 88 ms 37716 KB Execution killed with signal 11
83 Runtime error 87 ms 37724 KB Execution killed with signal 11
84 Runtime error 89 ms 37688 KB Execution killed with signal 11
85 Runtime error 97 ms 37724 KB Execution killed with signal 11
86 Runtime error 91 ms 37656 KB Execution killed with signal 11
87 Runtime error 87 ms 37664 KB Execution killed with signal 11
88 Runtime error 85 ms 37672 KB Execution killed with signal 11
89 Runtime error 86 ms 37752 KB Execution killed with signal 11
90 Runtime error 92 ms 35272 KB Execution killed with signal 11
91 Runtime error 90 ms 37776 KB Execution killed with signal 11
92 Runtime error 89 ms 37708 KB Execution killed with signal 11
93 Runtime error 94 ms 37684 KB Execution killed with signal 11
94 Runtime error 100 ms 37868 KB Execution killed with signal 11
95 Runtime error 87 ms 37736 KB Execution killed with signal 11
96 Runtime error 89 ms 37696 KB Execution killed with signal 11
97 Runtime error 104 ms 37740 KB Execution killed with signal 11
98 Runtime error 88 ms 37724 KB Execution killed with signal 11
99 Runtime error 90 ms 37668 KB Execution killed with signal 11
100 Runtime error 94 ms 37740 KB Execution killed with signal 11