답안 #386464

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
386464 2021-04-06T15:50:20 Z vanic Bomb (IZhO17_bomb) C++14
34 / 100
1000 ms 1260 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=2505;
 
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;
 
}
 
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;
			}
		}
	}
	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);
	if(n>100 || m>100){
		cout << mr*mc << '\n';
		return 0;
	}
	int maksi=0;
	for(int i=mr; i>0; i--){
		for(int j=mc; j>0; j--){
			if(provjeri(i, j)){
				maksi=max(maksi, i*j);
			}
		}
	}
	cout << maksi << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Correct 2 ms 1132 KB Output is correct
4 Correct 2 ms 1132 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 512 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Incorrect 1 ms 364 KB Output isn't correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Incorrect 1 ms 236 KB Output isn't correct
17 Incorrect 2 ms 364 KB Output isn't correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 30 ms 364 KB Output is correct
20 Correct 35 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 3 ms 364 KB Output is correct
23 Correct 240 ms 364 KB Output is correct
24 Correct 36 ms 364 KB Output is correct
25 Correct 786 ms 468 KB Output is correct
26 Incorrect 142 ms 492 KB Output isn't correct
27 Correct 2 ms 492 KB Output is correct
28 Incorrect 2 ms 364 KB Output isn't correct
29 Incorrect 2 ms 492 KB Output isn't correct
30 Incorrect 2 ms 492 KB Output isn't correct
31 Incorrect 2 ms 364 KB Output isn't correct
32 Incorrect 2 ms 512 KB Output isn't correct
33 Incorrect 2 ms 492 KB Output isn't correct
34 Incorrect 1 ms 364 KB Output isn't correct
35 Incorrect 2 ms 364 KB Output isn't correct
36 Correct 2 ms 492 KB Output is correct
37 Incorrect 2 ms 364 KB Output isn't correct
38 Correct 34 ms 1132 KB Output is correct
39 Correct 2 ms 364 KB Output is correct
40 Incorrect 5 ms 620 KB Output isn't correct
41 Correct 2 ms 364 KB Output is correct
42 Execution timed out 1090 ms 364 KB Time limit exceeded
43 Correct 32 ms 1132 KB Output is correct
44 Incorrect 2 ms 492 KB Output isn't correct
45 Incorrect 31 ms 1132 KB Output isn't correct
46 Correct 34 ms 1132 KB Output is correct
47 Incorrect 42 ms 1132 KB Output isn't correct
48 Incorrect 32 ms 1132 KB Output isn't correct
49 Correct 34 ms 1132 KB Output is correct
50 Incorrect 31 ms 1132 KB Output isn't correct
51 Incorrect 33 ms 1260 KB Output isn't correct
52 Incorrect 32 ms 1132 KB Output isn't correct
53 Incorrect 31 ms 1132 KB Output isn't correct
54 Incorrect 30 ms 1132 KB Output isn't correct
55 Incorrect 29 ms 1260 KB Output isn't correct
56 Correct 36 ms 1132 KB Output is correct
57 Incorrect 29 ms 1004 KB Output isn't correct
58 Incorrect 29 ms 1132 KB Output isn't correct
59 Incorrect 27 ms 1004 KB Output isn't correct
60 Correct 30 ms 1132 KB Output is correct
61 Correct 34 ms 1132 KB Output is correct
62 Correct 33 ms 1132 KB Output is correct
63 Correct 34 ms 1132 KB Output is correct
64 Correct 28 ms 1132 KB Output is correct
65 Incorrect 31 ms 1132 KB Output isn't correct
66 Incorrect 31 ms 1132 KB Output isn't correct
67 Incorrect 31 ms 1132 KB Output isn't correct
68 Incorrect 32 ms 1132 KB Output isn't correct
69 Incorrect 36 ms 1004 KB Output isn't correct
70 Incorrect 18 ms 620 KB Output isn't correct
71 Incorrect 28 ms 876 KB Output isn't correct
72 Incorrect 29 ms 876 KB Output isn't correct
73 Incorrect 29 ms 876 KB Output isn't correct
74 Incorrect 30 ms 1132 KB Output isn't correct
75 Incorrect 29 ms 1004 KB Output isn't correct
76 Incorrect 30 ms 1004 KB Output isn't correct
77 Incorrect 29 ms 1004 KB Output isn't correct
78 Incorrect 29 ms 1004 KB Output isn't correct
79 Incorrect 27 ms 620 KB Output isn't correct
80 Incorrect 28 ms 640 KB Output isn't correct
81 Incorrect 27 ms 620 KB Output isn't correct
82 Incorrect 30 ms 1048 KB Output isn't correct
83 Incorrect 30 ms 1132 KB Output isn't correct
84 Incorrect 25 ms 364 KB Output isn't correct
85 Incorrect 28 ms 1132 KB Output isn't correct
86 Incorrect 33 ms 1132 KB Output isn't correct
87 Incorrect 28 ms 1132 KB Output isn't correct
88 Incorrect 29 ms 1004 KB Output isn't correct
89 Incorrect 30 ms 1132 KB Output isn't correct
90 Incorrect 18 ms 1004 KB Output isn't correct
91 Incorrect 29 ms 1132 KB Output isn't correct
92 Incorrect 32 ms 1132 KB Output isn't correct
93 Incorrect 34 ms 1132 KB Output isn't correct
94 Incorrect 32 ms 1132 KB Output isn't correct
95 Incorrect 29 ms 1132 KB Output isn't correct
96 Incorrect 29 ms 1132 KB Output isn't correct
97 Incorrect 33 ms 1132 KB Output isn't correct
98 Incorrect 29 ms 1132 KB Output isn't correct
99 Incorrect 35 ms 1132 KB Output isn't correct
100 Incorrect 33 ms 1132 KB Output isn't correct