# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
172133 |
2019-12-31T10:57:25 Z |
MvC |
Bomb (IZhO17_bomb) |
C++14 |
|
1000 ms |
30616 KB |
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=3e3+50;
const int mod=1e9+7;
using namespace std;
int n,m,i,j,l,r,mid,rs,cur,ad[nmax][nmax],b[nmax][nmax],a[nmax][nmax];
char c;
bool ok(int h,int w)
{
int i,j,x;
for(i=1;i<=n;i++)for(j=1;j<=m;j++)ad[i][j]=0;
for(i=1;i<=n-h+1;i++)
{
for(j=1;j<=m-w+1;j++)
{
x=b[i+h-1][j+w-1]-b[i+h-1][j-1]-b[i-1][j+w-1]+b[i-1][j-1];
if(x==h*w)
{
ad[i][j]++;
ad[i][j+w]--;
ad[i+h][j]--;
ad[i+h][j+w]++;
}
ad[i][j]+=ad[i-1][j]+ad[i][j-1]-ad[i-1][j-1];
if(!ad[i][j] && a[i][j])return 0;
}
}
return 1;
}
int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
cin>>n>>m;
if(n*m>=1e6)rc(1);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
cin>>c;
a[i][j]=(c=='1');
b[i][j]=a[i][j]+b[i-1][j]+b[i][j-1]-b[i-1][j-1];
}
}
for(i=1;i<=n;i++)
{
l=1,r=m,cur=0;
while(l<=r)
{
mid=(l+r)/2;
if(ok(i,mid))cur=mid,l=mid+1;
else r=mid-1;
}
rs=max(rs,i*cur);
}
cout<<rs<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
632 KB |
Output is correct |
3 |
Incorrect |
147 ms |
30584 KB |
Output isn't correct |
4 |
Correct |
119 ms |
30616 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
632 KB |
Output is correct |
9 |
Correct |
2 ms |
632 KB |
Output is correct |
10 |
Correct |
2 ms |
504 KB |
Output is correct |
11 |
Correct |
2 ms |
632 KB |
Output is correct |
12 |
Correct |
2 ms |
508 KB |
Output is correct |
13 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
14 |
Correct |
2 ms |
504 KB |
Output is correct |
15 |
Correct |
2 ms |
504 KB |
Output is correct |
16 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
17 |
Correct |
3 ms |
1144 KB |
Output is correct |
18 |
Correct |
4 ms |
1276 KB |
Output is correct |
19 |
Correct |
5 ms |
1528 KB |
Output is correct |
20 |
Correct |
5 ms |
1528 KB |
Output is correct |
21 |
Correct |
3 ms |
1016 KB |
Output is correct |
22 |
Correct |
4 ms |
1400 KB |
Output is correct |
23 |
Correct |
7 ms |
1784 KB |
Output is correct |
24 |
Correct |
5 ms |
1400 KB |
Output is correct |
25 |
Correct |
8 ms |
1656 KB |
Output is correct |
26 |
Correct |
7 ms |
1656 KB |
Output is correct |
27 |
Correct |
71 ms |
4856 KB |
Output is correct |
28 |
Correct |
92 ms |
5240 KB |
Output is correct |
29 |
Incorrect |
192 ms |
6776 KB |
Output isn't correct |
30 |
Correct |
401 ms |
8056 KB |
Output is correct |
31 |
Correct |
253 ms |
6264 KB |
Output is correct |
32 |
Correct |
322 ms |
7260 KB |
Output is correct |
33 |
Correct |
558 ms |
8316 KB |
Output is correct |
34 |
Correct |
84 ms |
5624 KB |
Output is correct |
35 |
Correct |
259 ms |
8428 KB |
Output is correct |
36 |
Incorrect |
545 ms |
8440 KB |
Output isn't correct |
37 |
Correct |
2 ms |
632 KB |
Output is correct |
38 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
39 |
Correct |
2 ms |
632 KB |
Output is correct |
40 |
Execution timed out |
1075 ms |
20728 KB |
Time limit exceeded |
41 |
Correct |
2 ms |
632 KB |
Output is correct |
42 |
Correct |
10 ms |
1656 KB |
Output is correct |
43 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
44 |
Correct |
843 ms |
8428 KB |
Output is correct |
45 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
46 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
47 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
48 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
49 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
50 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
51 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
52 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
53 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
54 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
55 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
56 |
Incorrect |
2 ms |
424 KB |
Output isn't correct |
57 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
58 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
59 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
60 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
61 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
62 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
63 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
64 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
65 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
66 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
67 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
68 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
69 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
70 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
71 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
72 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
73 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
74 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
75 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
76 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
77 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
78 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
79 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
80 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
81 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
82 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
83 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
84 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
85 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
86 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
87 |
Incorrect |
2 ms |
372 KB |
Output isn't correct |
88 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
89 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
90 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
91 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
92 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
93 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
94 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
95 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
96 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
97 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
98 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
99 |
Incorrect |
2 ms |
380 KB |
Output isn't correct |
100 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |