# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
39232 |
2018-01-10T11:07:03 Z |
yerkimbekov |
Bomb (IZhO17_bomb) |
C++14 |
|
1000 ms |
51200 KB |
#include <bits/stdc++.h>
using namespace std;
int m,n,res=0,a[2505][2505],F[2505][2505];
int Suma(int u1,int v1,int u2,int v2)
{
return a[u2][v2]-a[u1-1][v2]-a[u2][v1-1]+a[u1-1][v1-1];
}
int SumF(int u1,int v1,int u2,int v2)
{
return F[u2][v2]-F[u1-1][v2]-F[u2][v1-1]+F[u1-1][v1-1];
}
bool Check(int mm,int nn)
{
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
F[i][j]=0;
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
{
F[i][j]=F[i-1][j]+F[i][j-1]-F[i-1][j-1];
if(i+mm-1<=m&&j+nn-1<=n&&Suma(i,j,i+mm-1,j+nn-1)==mm*nn)
F[i][j]++;
}
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
if(Suma(i,j,i,j)==1&&SumF(max(i-mm+1,1),max(j-nn+1,1),i,j)==0)
return false;
return true;
}
int main()
{
ios_base::sync_with_stdio(false);
//freopen("TEST.INP","r",stdin);
cin>>m>>n;
char c;
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
{
cin>>c;
a[i][j]=a[i-1][j]+a[i][j-1]-a[i-1][j-1]+(c=='1');
}
for(int i=1;i<=m;i++)
{
int l=1,r=n;
while(l<=r)
{
int mid=(l+r)/2;
if(Check(i,mid)==true)
{
res=max(res,i*mid);
l=mid+1;
}
else
r=mid-1;
}
}
cout<<res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
51200 KB |
Output is correct |
2 |
Correct |
0 ms |
51200 KB |
Output is correct |
3 |
Correct |
423 ms |
51200 KB |
Output is correct |
4 |
Correct |
389 ms |
51200 KB |
Output is correct |
5 |
Correct |
0 ms |
51200 KB |
Output is correct |
6 |
Correct |
0 ms |
51200 KB |
Output is correct |
7 |
Correct |
0 ms |
51200 KB |
Output is correct |
8 |
Correct |
0 ms |
51200 KB |
Output is correct |
9 |
Correct |
0 ms |
51200 KB |
Output is correct |
10 |
Correct |
0 ms |
51200 KB |
Output is correct |
11 |
Correct |
0 ms |
51200 KB |
Output is correct |
12 |
Correct |
0 ms |
51200 KB |
Output is correct |
13 |
Correct |
0 ms |
51200 KB |
Output is correct |
14 |
Correct |
0 ms |
51200 KB |
Output is correct |
15 |
Correct |
0 ms |
51200 KB |
Output is correct |
16 |
Correct |
0 ms |
51200 KB |
Output is correct |
17 |
Correct |
6 ms |
51200 KB |
Output is correct |
18 |
Correct |
6 ms |
51200 KB |
Output is correct |
19 |
Correct |
19 ms |
51200 KB |
Output is correct |
20 |
Correct |
26 ms |
51200 KB |
Output is correct |
21 |
Correct |
6 ms |
51200 KB |
Output is correct |
22 |
Correct |
13 ms |
51200 KB |
Output is correct |
23 |
Correct |
26 ms |
51200 KB |
Output is correct |
24 |
Correct |
9 ms |
51200 KB |
Output is correct |
25 |
Correct |
26 ms |
51200 KB |
Output is correct |
26 |
Correct |
26 ms |
51200 KB |
Output is correct |
27 |
Correct |
806 ms |
51200 KB |
Output is correct |
28 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
29 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
30 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
31 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
32 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
33 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
34 |
Correct |
876 ms |
51200 KB |
Output is correct |
35 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
36 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
37 |
Correct |
0 ms |
51200 KB |
Output is correct |
38 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
39 |
Correct |
0 ms |
51200 KB |
Output is correct |
40 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
41 |
Correct |
0 ms |
51200 KB |
Output is correct |
42 |
Correct |
39 ms |
51200 KB |
Output is correct |
43 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
44 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
45 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
46 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
47 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
48 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
49 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
50 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
51 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
52 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
53 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
54 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
55 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
56 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
57 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
58 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
59 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
60 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
61 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
62 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
63 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
64 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
65 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
66 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
67 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
68 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
69 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
70 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
71 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
72 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
73 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
74 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
75 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
76 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
77 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
78 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
79 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
80 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
81 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
82 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
83 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
84 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
85 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
86 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
87 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
88 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
89 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
90 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
91 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
92 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
93 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
94 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
95 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
96 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
97 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
98 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
99 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |
100 |
Execution timed out |
1000 ms |
51200 KB |
Execution timed out |