Submission #88105

# Submission time Handle Problem Language Result Execution time Memory
88105 2018-12-03T19:53:28 Z Pajaraja Bomb (IZhO17_bomb) C++17
0 / 100
91 ms 37548 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[i+x][j]-d[i][j+y]+d[i+x][j+y]==0) return false;
	return true;
}
int main()
{
	int lh=m,lv=n;
	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<=lh;i++)
	{
		while(!provera(i,lh)) 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]);
   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 508 KB Output isn't correct
3 Incorrect 27 ms 22728 KB Output isn't correct
4 Incorrect 27 ms 22768 KB Output isn't correct
5 Incorrect 2 ms 22768 KB Output isn't correct
6 Incorrect 2 ms 22768 KB Output isn't correct
7 Incorrect 2 ms 22768 KB Output isn't correct
8 Incorrect 3 ms 22768 KB Output isn't correct
9 Incorrect 2 ms 22768 KB Output isn't correct
10 Incorrect 2 ms 22768 KB Output isn't correct
11 Incorrect 2 ms 22768 KB Output isn't correct
12 Incorrect 2 ms 22768 KB Output isn't correct
13 Incorrect 2 ms 22768 KB Output isn't correct
14 Incorrect 2 ms 22768 KB Output isn't correct
15 Incorrect 2 ms 22768 KB Output isn't correct
16 Incorrect 2 ms 22768 KB Output isn't correct
17 Incorrect 3 ms 22768 KB Output isn't correct
18 Incorrect 3 ms 22768 KB Output isn't correct
19 Incorrect 4 ms 22768 KB Output isn't correct
20 Incorrect 3 ms 22768 KB Output isn't correct
21 Incorrect 3 ms 22768 KB Output isn't correct
22 Incorrect 3 ms 22768 KB Output isn't correct
23 Incorrect 3 ms 22768 KB Output isn't correct
24 Incorrect 3 ms 22768 KB Output isn't correct
25 Incorrect 3 ms 22768 KB Output isn't correct
26 Incorrect 3 ms 22768 KB Output isn't correct
27 Incorrect 6 ms 22768 KB Output isn't correct
28 Incorrect 7 ms 22768 KB Output isn't correct
29 Incorrect 8 ms 22768 KB Output isn't correct
30 Incorrect 8 ms 22768 KB Output isn't correct
31 Incorrect 7 ms 22768 KB Output isn't correct
32 Incorrect 7 ms 22768 KB Output isn't correct
33 Incorrect 8 ms 22768 KB Output isn't correct
34 Incorrect 7 ms 22768 KB Output isn't correct
35 Incorrect 9 ms 22768 KB Output isn't correct
36 Incorrect 10 ms 22768 KB Output isn't correct
37 Incorrect 2 ms 22768 KB Output isn't correct
38 Incorrect 81 ms 37368 KB Output isn't correct
39 Incorrect 2 ms 37368 KB Output isn't correct
40 Incorrect 20 ms 37368 KB Output isn't correct
41 Incorrect 2 ms 37368 KB Output isn't correct
42 Incorrect 3 ms 37368 KB Output isn't correct
43 Incorrect 88 ms 37368 KB Output isn't correct
44 Incorrect 10 ms 37368 KB Output isn't correct
45 Incorrect 83 ms 37436 KB Output isn't correct
46 Incorrect 91 ms 37436 KB Output isn't correct
47 Incorrect 82 ms 37436 KB Output isn't correct
48 Incorrect 81 ms 37436 KB Output isn't correct
49 Incorrect 83 ms 37436 KB Output isn't correct
50 Incorrect 82 ms 37436 KB Output isn't correct
51 Incorrect 80 ms 37436 KB Output isn't correct
52 Incorrect 82 ms 37436 KB Output isn't correct
53 Incorrect 80 ms 37436 KB Output isn't correct
54 Incorrect 81 ms 37436 KB Output isn't correct
55 Incorrect 80 ms 37436 KB Output isn't correct
56 Incorrect 85 ms 37436 KB Output isn't correct
57 Incorrect 82 ms 37436 KB Output isn't correct
58 Incorrect 80 ms 37436 KB Output isn't correct
59 Incorrect 82 ms 37500 KB Output isn't correct
60 Incorrect 84 ms 37500 KB Output isn't correct
61 Incorrect 91 ms 37500 KB Output isn't correct
62 Incorrect 86 ms 37500 KB Output isn't correct
63 Incorrect 82 ms 37500 KB Output isn't correct
64 Incorrect 86 ms 37500 KB Output isn't correct
65 Incorrect 82 ms 37500 KB Output isn't correct
66 Incorrect 88 ms 37500 KB Output isn't correct
67 Incorrect 80 ms 37500 KB Output isn't correct
68 Incorrect 87 ms 37500 KB Output isn't correct
69 Incorrect 88 ms 37500 KB Output isn't correct
70 Incorrect 62 ms 37500 KB Output isn't correct
71 Incorrect 86 ms 37500 KB Output isn't correct
72 Incorrect 84 ms 37500 KB Output isn't correct
73 Incorrect 84 ms 37500 KB Output isn't correct
74 Incorrect 84 ms 37500 KB Output isn't correct
75 Incorrect 84 ms 37500 KB Output isn't correct
76 Incorrect 85 ms 37500 KB Output isn't correct
77 Incorrect 84 ms 37500 KB Output isn't correct
78 Incorrect 84 ms 37500 KB Output isn't correct
79 Incorrect 82 ms 37500 KB Output isn't correct
80 Incorrect 84 ms 37548 KB Output isn't correct
81 Incorrect 82 ms 37548 KB Output isn't correct
82 Incorrect 87 ms 37548 KB Output isn't correct
83 Incorrect 80 ms 37548 KB Output isn't correct
84 Incorrect 78 ms 37548 KB Output isn't correct
85 Incorrect 80 ms 37548 KB Output isn't correct
86 Incorrect 83 ms 37548 KB Output isn't correct
87 Incorrect 89 ms 37548 KB Output isn't correct
88 Incorrect 86 ms 37548 KB Output isn't correct
89 Incorrect 81 ms 37548 KB Output isn't correct
90 Incorrect 60 ms 37548 KB Output isn't correct
91 Incorrect 85 ms 37548 KB Output isn't correct
92 Incorrect 88 ms 37548 KB Output isn't correct
93 Incorrect 88 ms 37548 KB Output isn't correct
94 Incorrect 88 ms 37548 KB Output isn't correct
95 Incorrect 83 ms 37548 KB Output isn't correct
96 Incorrect 86 ms 37548 KB Output isn't correct
97 Incorrect 86 ms 37548 KB Output isn't correct
98 Incorrect 84 ms 37548 KB Output isn't correct
99 Incorrect 81 ms 37548 KB Output isn't correct
100 Incorrect 83 ms 37548 KB Output isn't correct