답안 #88089

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88089 2018-12-03T19:31:14 Z Pajaraja Bomb (IZhO17_bomb) C++17
4 / 100
1000 ms 132096 KB
#include <bits/stdc++.h>
using namespace std;
bool t[2507][2507],r[2507][2507];
int p[2507][2507],d[2507][2507],n,m;
bool provera(int x,int y)
{
	for(int i=x;i<=n;i++) for(int j=y;j<=m;j++) r[i][j]=(p[i][j]-p[i-x][j]-p[i][j-y]+p[i-x][j-y]==x*y);
	for(int i=n;i>0;i--) for(int j=m;j>0;j--) d[i][j]=r[i][j]+d[i+1][j]+d[i][j+1]-d[i+1][j+1];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(t[i][j] && p[i][j]-p[i+x][j]-p[i][j+y]+p[i+x][j+y]==0) return false;
	return true;
}
int main()
{
	int lh=2507,lv=2507;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		string s;
		cin>>s;
		for(int j=1;j<=m;j++) t[i][j]=(s[j-1]=='1'?1:0);
	}
	for(int i=1;i<=n;i++)
	{
		int cur=0;
		for(int j=1;j<=m;j++)
		{
			if(t[i][j]==0) {if(cur!=0) lh=min(lh,cur); cur=0;}
			else cur++;
		}
		if(cur!=0) lh=min(lh,cur);
	}
	for(int i=1;i<=m;i++)
	{
		int cur=0;
		for(int j=1;j<=n;j++)
		{
			if(t[j][i]==0) { if(cur!=0) lv=min(lv,cur); cur=0;}
			else cur++;
		}
		if(cur!=0) lv=min(lv,cur);
	}
	int sol=0;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) p[i][j]=t[i][j]+p[i-1][j]+p[i][j-1]-p[i-1][j-1];
	for(int i=1;i<=lh;i++)
	{
		while(!provera(i,lv)) lv--; 
		sol=max(sol,lv*i);
	}
	printf("%d",sol);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Execution timed out 1065 ms 836 KB Time limit exceeded
3 Execution timed out 1063 ms 32832 KB Time limit exceeded
4 Execution timed out 1068 ms 32832 KB Time limit exceeded
5 Incorrect 3 ms 32832 KB Output isn't correct
6 Incorrect 2 ms 32832 KB Output isn't correct
7 Correct 2 ms 32832 KB Output is correct
8 Execution timed out 1072 ms 32832 KB Time limit exceeded
9 Execution timed out 1061 ms 32832 KB Time limit exceeded
10 Execution timed out 1067 ms 32832 KB Time limit exceeded
11 Execution timed out 1053 ms 32832 KB Time limit exceeded
12 Execution timed out 1073 ms 32832 KB Time limit exceeded
13 Execution timed out 1064 ms 32832 KB Time limit exceeded
14 Incorrect 72 ms 32832 KB Output isn't correct
15 Execution timed out 1069 ms 32832 KB Time limit exceeded
16 Incorrect 90 ms 32832 KB Output isn't correct
17 Execution timed out 1077 ms 32832 KB Time limit exceeded
18 Execution timed out 1073 ms 32832 KB Time limit exceeded
19 Execution timed out 1074 ms 32832 KB Time limit exceeded
20 Execution timed out 1086 ms 32832 KB Time limit exceeded
21 Execution timed out 1088 ms 32832 KB Time limit exceeded
22 Execution timed out 1084 ms 32832 KB Time limit exceeded
23 Execution timed out 1073 ms 32832 KB Time limit exceeded
24 Execution timed out 1080 ms 32832 KB Time limit exceeded
25 Execution timed out 1078 ms 32832 KB Time limit exceeded
26 Correct 5 ms 32832 KB Output is correct
27 Execution timed out 1082 ms 32832 KB Time limit exceeded
28 Execution timed out 1072 ms 32832 KB Time limit exceeded
29 Incorrect 82 ms 32832 KB Output isn't correct
30 Execution timed out 1082 ms 32832 KB Time limit exceeded
31 Execution timed out 1082 ms 32832 KB Time limit exceeded
32 Execution timed out 1072 ms 32832 KB Time limit exceeded
33 Execution timed out 1078 ms 32832 KB Time limit exceeded
34 Execution timed out 1080 ms 32832 KB Time limit exceeded
35 Execution timed out 1067 ms 32832 KB Time limit exceeded
36 Correct 54 ms 32832 KB Output is correct
37 Incorrect 2 ms 32832 KB Output isn't correct
38 Execution timed out 1071 ms 69872 KB Time limit exceeded
39 Incorrect 2 ms 69872 KB Output isn't correct
40 Execution timed out 1078 ms 69872 KB Time limit exceeded
41 Incorrect 3 ms 69872 KB Output isn't correct
42 Incorrect 13 ms 69872 KB Output isn't correct
43 Execution timed out 1086 ms 76800 KB Time limit exceeded
44 Incorrect 842 ms 76800 KB Output isn't correct
45 Execution timed out 1066 ms 83060 KB Time limit exceeded
46 Execution timed out 1089 ms 89256 KB Time limit exceeded
47 Execution timed out 1057 ms 95300 KB Time limit exceeded
48 Execution timed out 1067 ms 101396 KB Time limit exceeded
49 Correct 467 ms 107520 KB Output is correct
50 Execution timed out 1085 ms 113780 KB Time limit exceeded
51 Execution timed out 1091 ms 119956 KB Time limit exceeded
52 Execution timed out 1069 ms 125896 KB Time limit exceeded
53 Execution timed out 1033 ms 131996 KB Time limit exceeded
54 Execution timed out 1083 ms 132096 KB Time limit exceeded
55 Execution timed out 1067 ms 132096 KB Time limit exceeded
56 Execution timed out 1080 ms 132096 KB Time limit exceeded
57 Execution timed out 1078 ms 132096 KB Time limit exceeded
58 Execution timed out 1084 ms 132096 KB Time limit exceeded
59 Execution timed out 1088 ms 132096 KB Time limit exceeded
60 Execution timed out 1066 ms 132096 KB Time limit exceeded
61 Execution timed out 1092 ms 132096 KB Time limit exceeded
62 Execution timed out 1028 ms 132096 KB Time limit exceeded
63 Execution timed out 1080 ms 132096 KB Time limit exceeded
64 Execution timed out 1084 ms 132096 KB Time limit exceeded
65 Execution timed out 1081 ms 132096 KB Time limit exceeded
66 Execution timed out 1049 ms 132096 KB Time limit exceeded
67 Execution timed out 1048 ms 132096 KB Time limit exceeded
68 Execution timed out 1043 ms 132096 KB Time limit exceeded
69 Execution timed out 1055 ms 132096 KB Time limit exceeded
70 Execution timed out 1059 ms 132096 KB Time limit exceeded
71 Execution timed out 1035 ms 132096 KB Time limit exceeded
72 Execution timed out 1062 ms 132096 KB Time limit exceeded
73 Execution timed out 1058 ms 132096 KB Time limit exceeded
74 Execution timed out 1081 ms 132096 KB Time limit exceeded
75 Execution timed out 1072 ms 132096 KB Time limit exceeded
76 Execution timed out 1016 ms 132096 KB Time limit exceeded
77 Execution timed out 1061 ms 132096 KB Time limit exceeded
78 Execution timed out 1018 ms 132096 KB Time limit exceeded
79 Execution timed out 1050 ms 132096 KB Time limit exceeded
80 Execution timed out 1026 ms 132096 KB Time limit exceeded
81 Execution timed out 1074 ms 132096 KB Time limit exceeded
82 Execution timed out 1068 ms 132096 KB Time limit exceeded
83 Execution timed out 1018 ms 132096 KB Time limit exceeded
84 Execution timed out 1043 ms 132096 KB Time limit exceeded
85 Execution timed out 1008 ms 132096 KB Time limit exceeded
86 Execution timed out 1048 ms 132096 KB Time limit exceeded
87 Execution timed out 1043 ms 132096 KB Time limit exceeded
88 Execution timed out 1054 ms 132096 KB Time limit exceeded
89 Execution timed out 1030 ms 132096 KB Time limit exceeded
90 Execution timed out 1008 ms 132096 KB Time limit exceeded
91 Execution timed out 1074 ms 132096 KB Time limit exceeded
92 Execution timed out 1070 ms 132096 KB Time limit exceeded
93 Execution timed out 1091 ms 132096 KB Time limit exceeded
94 Execution timed out 1083 ms 132096 KB Time limit exceeded
95 Execution timed out 1059 ms 132096 KB Time limit exceeded
96 Execution timed out 1065 ms 132096 KB Time limit exceeded
97 Execution timed out 1102 ms 132096 KB Time limit exceeded
98 Execution timed out 1058 ms 132096 KB Time limit exceeded
99 Execution timed out 1049 ms 132096 KB Time limit exceeded
100 Execution timed out 1076 ms 132096 KB Time limit exceeded