Submission #386447

# Submission time Handle Problem Language Result Execution time Memory
386447 2021-04-06T15:01:28 Z vanic Bomb (IZhO17_bomb) C++14
15 / 100
1000 ms 640 KB
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <map>
#include <cstring>
#include <array>
#include <bitset>
#include <cassert>

using namespace std;

const int maxn=20;

bitset < maxn > a[maxn];
bitset < maxn > b[maxn];
int n, m;

bool provjeri(int x, int y){
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			b[i][j]=a[i][j];
		}
	}
	bool ne;
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(a[i][j]){
				ne=0;
				for(int k=i; k<i+x; k++){
					for(int l=j; l<j+y; l++){
						if(k>=n || l>=m || !a[k][l]){
							ne=1;
							break;
						}
						if(ne){
							break;
						}
					}
				}
				if(!ne){
					for(int k=i; k<i+x; k++){
						for(int l=j; l<j+y; l++){
							b[k][l]=0;
						}
					}
				}
			}
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(b[i][j]){
				return 0;
			}
		}
	}
	return 1;

}

void radi2(){
	int br=0;
	int mr=1e9, mc=1e9;
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			if(a[i][j]){
				br++;
			}
			else if(br){
				mr=min(mr, br);
				br=0;
			}
		}
		if(br){
			mr=min(mr, br);
			br=0;
		}
	}
	for(int j=0; j<m; j++){
		for(int i=0; i<n; i++){
			if(a[i][j]){
				br++;
			}
			else if(br){
				mc=min(mc, br);
				br=0;
			}
		}
		if(br){
			mc=min(mc, br);
			br=0;
		}
	}
	assert(mr!=1e9);
	cout << mr*mc << '\n';
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	string s;
	for(int i=0; i<n; i++){
		cin >> s;
		for(int j=0; j<m; j++){
			if(s[j]=='1'){
				a[i][j]=1;
			}
		}
	}
	if(n>100 || m>100){
		radi2();
		return 0;
	}
	int maksi=0;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(provjeri(i, j)){
				maksi=max(maksi, i*j);
			}
		}
	}
	cout << maksi << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Runtime error 1 ms 492 KB Execution killed with signal 11
4 Runtime error 1 ms 492 KB Execution killed with signal 11
5 Incorrect 1 ms 364 KB Output isn't correct
6 Incorrect 1 ms 364 KB Output isn't correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 3 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 3 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 8 ms 364 KB Output is correct
17 Runtime error 693 ms 492 KB Execution killed with signal 11
18 Runtime error 123 ms 620 KB Execution killed with signal 11
19 Runtime error 486 ms 620 KB Execution killed with signal 11
20 Runtime error 547 ms 640 KB Execution killed with signal 11
21 Runtime error 107 ms 520 KB Execution killed with signal 11
22 Runtime error 473 ms 620 KB Execution killed with signal 11
23 Runtime error 871 ms 620 KB Execution killed with signal 11
24 Runtime error 182 ms 620 KB Execution killed with signal 11
25 Execution timed out 1094 ms 364 KB Time limit exceeded
26 Execution timed out 1079 ms 364 KB Time limit exceeded
27 Runtime error 2 ms 620 KB Execution killed with signal 11
28 Runtime error 2 ms 492 KB Execution killed with signal 11
29 Runtime error 2 ms 492 KB Execution killed with signal 11
30 Runtime error 2 ms 492 KB Execution killed with signal 11
31 Runtime error 2 ms 492 KB Execution killed with signal 11
32 Runtime error 2 ms 492 KB Execution killed with signal 11
33 Runtime error 2 ms 492 KB Execution killed with signal 11
34 Runtime error 3 ms 492 KB Execution killed with signal 11
35 Runtime error 3 ms 492 KB Execution killed with signal 11
36 Runtime error 2 ms 492 KB Execution killed with signal 11
37 Correct 4 ms 364 KB Output is correct
38 Runtime error 3 ms 492 KB Execution killed with signal 11
39 Correct 5 ms 364 KB Output is correct
40 Runtime error 3 ms 492 KB Execution killed with signal 11
41 Correct 5 ms 364 KB Output is correct
42 Execution timed out 1091 ms 512 KB Time limit exceeded
43 Runtime error 3 ms 492 KB Execution killed with signal 11
44 Runtime error 2 ms 492 KB Execution killed with signal 11
45 Runtime error 3 ms 492 KB Execution killed with signal 11
46 Runtime error 4 ms 492 KB Execution killed with signal 11
47 Runtime error 3 ms 492 KB Execution killed with signal 11
48 Runtime error 3 ms 492 KB Execution killed with signal 11
49 Runtime error 3 ms 492 KB Execution killed with signal 11
50 Runtime error 3 ms 492 KB Execution killed with signal 11
51 Runtime error 3 ms 492 KB Execution killed with signal 11
52 Runtime error 3 ms 492 KB Execution killed with signal 11
53 Runtime error 3 ms 492 KB Execution killed with signal 11
54 Runtime error 3 ms 492 KB Execution killed with signal 11
55 Runtime error 3 ms 492 KB Execution killed with signal 11
56 Runtime error 4 ms 492 KB Execution killed with signal 11
57 Runtime error 3 ms 492 KB Execution killed with signal 11
58 Runtime error 3 ms 492 KB Execution killed with signal 11
59 Runtime error 3 ms 492 KB Execution killed with signal 11
60 Runtime error 3 ms 492 KB Execution killed with signal 11
61 Runtime error 3 ms 492 KB Execution killed with signal 11
62 Runtime error 3 ms 492 KB Execution killed with signal 11
63 Runtime error 3 ms 492 KB Execution killed with signal 11
64 Runtime error 3 ms 492 KB Execution killed with signal 11
65 Runtime error 3 ms 492 KB Execution killed with signal 11
66 Runtime error 3 ms 492 KB Execution killed with signal 11
67 Runtime error 3 ms 492 KB Execution killed with signal 11
68 Runtime error 4 ms 492 KB Execution killed with signal 11
69 Runtime error 3 ms 492 KB Execution killed with signal 11
70 Runtime error 3 ms 492 KB Execution killed with signal 11
71 Runtime error 3 ms 492 KB Execution killed with signal 11
72 Runtime error 3 ms 492 KB Execution killed with signal 11
73 Runtime error 3 ms 492 KB Execution killed with signal 11
74 Runtime error 3 ms 492 KB Execution killed with signal 11
75 Runtime error 3 ms 492 KB Execution killed with signal 11
76 Runtime error 3 ms 492 KB Execution killed with signal 11
77 Runtime error 3 ms 492 KB Execution killed with signal 11
78 Runtime error 3 ms 492 KB Execution killed with signal 11
79 Runtime error 3 ms 492 KB Execution killed with signal 11
80 Runtime error 2 ms 492 KB Execution killed with signal 11
81 Runtime error 3 ms 492 KB Execution killed with signal 11
82 Runtime error 3 ms 492 KB Execution killed with signal 11
83 Runtime error 3 ms 492 KB Execution killed with signal 11
84 Runtime error 34 ms 492 KB Execution killed with signal 11
85 Runtime error 3 ms 492 KB Execution killed with signal 11
86 Runtime error 3 ms 492 KB Execution killed with signal 11
87 Runtime error 3 ms 492 KB Execution killed with signal 11
88 Runtime error 3 ms 492 KB Execution killed with signal 11
89 Runtime error 3 ms 492 KB Execution killed with signal 11
90 Runtime error 3 ms 492 KB Execution killed with signal 11
91 Runtime error 3 ms 492 KB Execution killed with signal 11
92 Runtime error 3 ms 492 KB Execution killed with signal 11
93 Runtime error 3 ms 492 KB Execution killed with signal 11
94 Runtime error 3 ms 492 KB Execution killed with signal 11
95 Runtime error 3 ms 492 KB Execution killed with signal 11
96 Runtime error 3 ms 492 KB Execution killed with signal 11
97 Runtime error 3 ms 492 KB Execution killed with signal 11
98 Runtime error 3 ms 492 KB Execution killed with signal 11
99 Runtime error 3 ms 492 KB Execution killed with signal 11
100 Runtime error 3 ms 492 KB Execution killed with signal 11