답안 #88098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88098 2018-12-03T19:46:47 Z Pajaraja Bomb (IZhO17_bomb) C++17
14 / 100
1000 ms 83636 KB
#include <bits/stdc++.h>
#define MAXN 2507
using namespace std;
bool t[MAXN][MAXN],r[MAXN][MAXN];
int p[MAXN][MAXN],d[MAXN][MAXN],n,m;
char s[MAXN][MAXN];
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] && d[i][j]-d[min(n,i+x)][j]-d[i][min(m,j+y)]+d[min(n,i+x)][min(m,j+y)]==0) return false;
	return true;
}
int main()
{
	int lh=2507,lv=2507;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s[i]);
		for(int j=1;j<=m;j++) t[i][j]=(s[i][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<=lv;i++)
	{
		while(!provera(lh,i)) lh--; 
		sol=max(sol,lh*i);
	}
	printf("%d",sol);
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
bomb.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",s[i]);
   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 18 ms 3708 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 13 ms 4548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 298 ms 79648 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 301 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 725 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 304 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 14 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Correct 2 ms 79736 KB Output is correct
9 Correct 3 ms 79736 KB Output is correct
10 Incorrect 2 ms 79736 KB Output isn't correct
11 Correct 3 ms 79736 KB Output is correct
12 Incorrect 3 ms 79736 KB Output isn't correct
13 Incorrect 2 ms 79736 KB Output isn't correct
14 Runtime error 19 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Correct 3 ms 79736 KB Output is correct
16 Runtime error 21 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 52 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Correct 4 ms 79736 KB Output is correct
19 Runtime error 63 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 65 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Correct 3 ms 79736 KB Output is correct
22 Correct 4 ms 79736 KB Output is correct
23 Correct 7 ms 79736 KB Output is correct
24 Runtime error 57 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Correct 8 ms 79736 KB Output is correct
26 Runtime error 82 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 363 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Correct 18 ms 79736 KB Output is correct
29 Runtime error 615 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Correct 256 ms 79736 KB Output is correct
31 Correct 155 ms 79736 KB Output is correct
32 Runtime error 745 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Correct 334 ms 79736 KB Output is correct
34 Correct 17 ms 79736 KB Output is correct
35 Incorrect 176 ms 79736 KB Output isn't correct
36 Runtime error 841 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 25 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Execution timed out 1087 ms 79736 KB Time limit exceeded
39 Runtime error 20 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Execution timed out 1082 ms 79736 KB Time limit exceeded
41 Runtime error 21 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
42 Runtime error 81 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
43 Execution timed out 1070 ms 79736 KB Time limit exceeded
44 Runtime error 1002 ms 79736 KB Execution killed with signal 11 (could be triggered by violating memory limits)
45 Execution timed out 1083 ms 79736 KB Time limit exceeded
46 Execution timed out 1072 ms 79764 KB Time limit exceeded
47 Execution timed out 1077 ms 79764 KB Time limit exceeded
48 Execution timed out 1072 ms 79764 KB Time limit exceeded
49 Execution timed out 1062 ms 79908 KB Time limit exceeded
50 Execution timed out 1051 ms 80032 KB Time limit exceeded
51 Execution timed out 1069 ms 80072 KB Time limit exceeded
52 Execution timed out 1060 ms 80148 KB Time limit exceeded
53 Execution timed out 1059 ms 80296 KB Time limit exceeded
54 Execution timed out 1062 ms 80296 KB Time limit exceeded
55 Execution timed out 1060 ms 82008 KB Time limit exceeded
56 Execution timed out 1077 ms 82132 KB Time limit exceeded
57 Execution timed out 1084 ms 82132 KB Time limit exceeded
58 Execution timed out 1085 ms 82132 KB Time limit exceeded
59 Execution timed out 1071 ms 82132 KB Time limit exceeded
60 Execution timed out 1070 ms 82132 KB Time limit exceeded
61 Execution timed out 1065 ms 82132 KB Time limit exceeded
62 Execution timed out 1044 ms 82132 KB Time limit exceeded
63 Execution timed out 1066 ms 82132 KB Time limit exceeded
64 Execution timed out 1072 ms 82132 KB Time limit exceeded
65 Execution timed out 1074 ms 82132 KB Time limit exceeded
66 Execution timed out 1055 ms 82132 KB Time limit exceeded
67 Execution timed out 1078 ms 82624 KB Time limit exceeded
68 Execution timed out 1085 ms 82624 KB Time limit exceeded
69 Execution timed out 1090 ms 82972 KB Time limit exceeded
70 Execution timed out 1088 ms 82972 KB Time limit exceeded
71 Execution timed out 1067 ms 82972 KB Time limit exceeded
72 Execution timed out 1073 ms 82972 KB Time limit exceeded
73 Execution timed out 1086 ms 82972 KB Time limit exceeded
74 Execution timed out 1081 ms 82972 KB Time limit exceeded
75 Execution timed out 1090 ms 82972 KB Time limit exceeded
76 Execution timed out 1072 ms 82972 KB Time limit exceeded
77 Execution timed out 1061 ms 82972 KB Time limit exceeded
78 Execution timed out 1066 ms 82972 KB Time limit exceeded
79 Execution timed out 1056 ms 83272 KB Time limit exceeded
80 Execution timed out 1069 ms 83444 KB Time limit exceeded
81 Execution timed out 1082 ms 83444 KB Time limit exceeded
82 Execution timed out 1048 ms 83444 KB Time limit exceeded
83 Execution timed out 1082 ms 83444 KB Time limit exceeded
84 Execution timed out 1062 ms 83444 KB Time limit exceeded
85 Execution timed out 1072 ms 83444 KB Time limit exceeded
86 Execution timed out 1077 ms 83444 KB Time limit exceeded
87 Execution timed out 1052 ms 83444 KB Time limit exceeded
88 Execution timed out 1067 ms 83444 KB Time limit exceeded
89 Execution timed out 1066 ms 83444 KB Time limit exceeded
90 Execution timed out 1075 ms 83444 KB Time limit exceeded
91 Execution timed out 1061 ms 83444 KB Time limit exceeded
92 Execution timed out 1072 ms 83444 KB Time limit exceeded
93 Execution timed out 1060 ms 83636 KB Time limit exceeded
94 Execution timed out 1077 ms 83636 KB Time limit exceeded
95 Execution timed out 1071 ms 83636 KB Time limit exceeded
96 Execution timed out 1045 ms 83636 KB Time limit exceeded
97 Execution timed out 1068 ms 83636 KB Time limit exceeded
98 Execution timed out 1058 ms 83636 KB Time limit exceeded
99 Execution timed out 1064 ms 83636 KB Time limit exceeded
100 Execution timed out 1078 ms 83636 KB Time limit exceeded