Submission #833569

# Submission time Handle Problem Language Result Execution time Memory
833569 2023-08-22T06:55:00 Z vjudge1 Bomb (IZhO17_bomb) C++17
0 / 100
17 ms 25440 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;
	if(n > 20 || m > 20){
		cout<<1<<endl;
		return 0;
	}
	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 17 ms 25304 KB Execution killed with signal 11
2 Runtime error 16 ms 25428 KB Execution killed with signal 11
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Runtime error 15 ms 25308 KB Execution killed with signal 11
8 Runtime error 16 ms 25428 KB Execution killed with signal 11
9 Runtime error 15 ms 25428 KB Execution killed with signal 11
10 Runtime error 16 ms 25428 KB Execution killed with signal 11
11 Runtime error 16 ms 25440 KB Execution killed with signal 11
12 Runtime error 16 ms 25400 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 15 ms 25356 KB Execution killed with signal 11
17 Incorrect 0 ms 212 KB Output isn't correct
18 Incorrect 0 ms 212 KB Output isn't correct
19 Incorrect 1 ms 212 KB Output isn't correct
20 Incorrect 0 ms 212 KB Output isn't correct
21 Incorrect 0 ms 212 KB Output isn't correct
22 Incorrect 0 ms 212 KB Output isn't correct
23 Incorrect 0 ms 212 KB Output isn't correct
24 Incorrect 1 ms 212 KB Output isn't correct
25 Incorrect 0 ms 212 KB Output isn't correct
26 Incorrect 0 ms 212 KB Output isn't correct
27 Incorrect 1 ms 212 KB Output isn't correct
28 Incorrect 1 ms 212 KB Output isn't correct
29 Incorrect 0 ms 212 KB Output isn't correct
30 Incorrect 1 ms 212 KB Output isn't correct
31 Incorrect 0 ms 212 KB Output isn't correct
32 Incorrect 0 ms 212 KB Output isn't correct
33 Incorrect 0 ms 212 KB Output isn't correct
34 Incorrect 1 ms 212 KB Output isn't correct
35 Incorrect 0 ms 212 KB Output isn't correct
36 Incorrect 0 ms 212 KB Output isn't correct
37 Runtime error 15 ms 25428 KB Execution killed with signal 11
38 Incorrect 0 ms 212 KB Output isn't correct
39 Runtime error 16 ms 25428 KB Execution killed with signal 11
40 Incorrect 0 ms 212 KB Output isn't correct
41 Runtime error 16 ms 25428 KB Execution killed with signal 11
42 Incorrect 0 ms 212 KB Output isn't correct
43 Incorrect 0 ms 212 KB Output isn't correct
44 Incorrect 1 ms 212 KB Output isn't correct
45 Incorrect 1 ms 212 KB Output isn't correct
46 Incorrect 0 ms 212 KB Output isn't correct
47 Incorrect 1 ms 212 KB Output isn't correct
48 Incorrect 0 ms 212 KB Output isn't correct
49 Incorrect 1 ms 212 KB Output isn't correct
50 Incorrect 0 ms 212 KB Output isn't correct
51 Incorrect 1 ms 212 KB Output isn't correct
52 Incorrect 0 ms 212 KB Output isn't correct
53 Incorrect 0 ms 212 KB Output isn't correct
54 Incorrect 1 ms 212 KB Output isn't correct
55 Incorrect 1 ms 212 KB Output isn't correct
56 Incorrect 1 ms 212 KB Output isn't correct
57 Incorrect 0 ms 212 KB Output isn't correct
58 Incorrect 0 ms 212 KB Output isn't correct
59 Incorrect 1 ms 212 KB Output isn't correct
60 Incorrect 1 ms 212 KB Output isn't correct
61 Incorrect 0 ms 212 KB Output isn't correct
62 Incorrect 1 ms 212 KB Output isn't correct
63 Incorrect 0 ms 212 KB Output isn't correct
64 Incorrect 0 ms 212 KB Output isn't correct
65 Incorrect 0 ms 212 KB Output isn't correct
66 Incorrect 1 ms 212 KB Output isn't correct
67 Incorrect 1 ms 212 KB Output isn't correct
68 Incorrect 0 ms 212 KB Output isn't correct
69 Incorrect 1 ms 212 KB Output isn't correct
70 Incorrect 0 ms 212 KB Output isn't correct
71 Incorrect 0 ms 212 KB Output isn't correct
72 Incorrect 0 ms 212 KB Output isn't correct
73 Incorrect 0 ms 212 KB Output isn't correct
74 Incorrect 1 ms 336 KB Output isn't correct
75 Incorrect 0 ms 212 KB Output isn't correct
76 Incorrect 0 ms 212 KB Output isn't correct
77 Incorrect 0 ms 212 KB Output isn't correct
78 Incorrect 0 ms 212 KB Output isn't correct
79 Incorrect 1 ms 212 KB Output isn't correct
80 Incorrect 1 ms 212 KB Output isn't correct
81 Incorrect 1 ms 212 KB Output isn't correct
82 Incorrect 0 ms 212 KB Output isn't correct
83 Incorrect 0 ms 212 KB Output isn't correct
84 Incorrect 1 ms 212 KB Output isn't correct
85 Incorrect 0 ms 212 KB Output isn't correct
86 Incorrect 1 ms 212 KB Output isn't correct
87 Incorrect 0 ms 212 KB Output isn't correct
88 Incorrect 0 ms 212 KB Output isn't correct
89 Incorrect 0 ms 212 KB Output isn't correct
90 Incorrect 1 ms 212 KB Output isn't correct
91 Incorrect 0 ms 212 KB Output isn't correct
92 Incorrect 0 ms 212 KB Output isn't correct
93 Incorrect 1 ms 212 KB Output isn't correct
94 Incorrect 0 ms 212 KB Output isn't correct
95 Incorrect 0 ms 212 KB Output isn't correct
96 Incorrect 0 ms 212 KB Output isn't correct
97 Incorrect 0 ms 212 KB Output isn't correct
98 Incorrect 0 ms 212 KB Output isn't correct
99 Incorrect 0 ms 212 KB Output isn't correct
100 Incorrect 1 ms 212 KB Output isn't correct