# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
172138 |
2019-12-31T11:04:35 Z |
MvC |
Bomb (IZhO17_bomb) |
C++11 |
|
1000 ms |
95848 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;
if(n==max(n,m))swap(h,w);
for(i=1;i<=n;i++)for(j=1;j<=m;j++)ad[i][j]=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
if(i<=n-h+1 && j<=m-w+1)
{
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>=1250000)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<=min(n,m);i++)
{
l=1,r=max(n,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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
632 KB |
Output is correct |
3 |
Correct |
30 ms |
30456 KB |
Output is correct |
4 |
Correct |
30 ms |
30588 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
504 KB |
Output is correct |
9 |
Correct |
2 ms |
508 KB |
Output is correct |
10 |
Correct |
2 ms |
504 KB |
Output is correct |
11 |
Correct |
2 ms |
504 KB |
Output is correct |
12 |
Correct |
2 ms |
504 KB |
Output is correct |
13 |
Correct |
2 ms |
504 KB |
Output is correct |
14 |
Correct |
2 ms |
504 KB |
Output is correct |
15 |
Correct |
2 ms |
632 KB |
Output is correct |
16 |
Correct |
2 ms |
632 KB |
Output is correct |
17 |
Correct |
3 ms |
1144 KB |
Output is correct |
18 |
Correct |
3 ms |
1272 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 |
9 ms |
1656 KB |
Output is correct |
24 |
Correct |
4 ms |
1404 KB |
Output is correct |
25 |
Correct |
9 ms |
1656 KB |
Output is correct |
26 |
Correct |
8 ms |
1656 KB |
Output is correct |
27 |
Correct |
67 ms |
4856 KB |
Output is correct |
28 |
Correct |
93 ms |
5240 KB |
Output is correct |
29 |
Correct |
400 ms |
6548 KB |
Output is correct |
30 |
Correct |
444 ms |
7928 KB |
Output is correct |
31 |
Correct |
275 ms |
6264 KB |
Output is correct |
32 |
Correct |
298 ms |
7032 KB |
Output is correct |
33 |
Correct |
857 ms |
8184 KB |
Output is correct |
34 |
Correct |
66 ms |
5496 KB |
Output is correct |
35 |
Correct |
390 ms |
8284 KB |
Output is correct |
36 |
Correct |
807 ms |
8312 KB |
Output is correct |
37 |
Correct |
2 ms |
632 KB |
Output is correct |
38 |
Execution timed out |
1084 ms |
95460 KB |
Time limit exceeded |
39 |
Correct |
2 ms |
632 KB |
Output is correct |
40 |
Execution timed out |
1079 ms |
19960 KB |
Time limit exceeded |
41 |
Correct |
2 ms |
632 KB |
Output is correct |
42 |
Correct |
13 ms |
1656 KB |
Output is correct |
43 |
Execution timed out |
1091 ms |
95848 KB |
Time limit exceeded |
44 |
Execution timed out |
1078 ms |
8184 KB |
Time limit exceeded |
45 |
Execution timed out |
1075 ms |
95480 KB |
Time limit exceeded |
46 |
Execution timed out |
1078 ms |
95352 KB |
Time limit exceeded |
47 |
Execution timed out |
1082 ms |
95352 KB |
Time limit exceeded |
48 |
Execution timed out |
1079 ms |
95352 KB |
Time limit exceeded |
49 |
Execution timed out |
1074 ms |
95352 KB |
Time limit exceeded |
50 |
Execution timed out |
1060 ms |
95360 KB |
Time limit exceeded |
51 |
Execution timed out |
1067 ms |
95212 KB |
Time limit exceeded |
52 |
Execution timed out |
1063 ms |
95208 KB |
Time limit exceeded |
53 |
Execution timed out |
1087 ms |
94840 KB |
Time limit exceeded |
54 |
Execution timed out |
1085 ms |
94840 KB |
Time limit exceeded |
55 |
Execution timed out |
1086 ms |
94840 KB |
Time limit exceeded |
56 |
Execution timed out |
1077 ms |
94572 KB |
Time limit exceeded |
57 |
Execution timed out |
1079 ms |
94456 KB |
Time limit exceeded |
58 |
Execution timed out |
1084 ms |
94400 KB |
Time limit exceeded |
59 |
Execution timed out |
1086 ms |
94200 KB |
Time limit exceeded |
60 |
Execution timed out |
1080 ms |
94132 KB |
Time limit exceeded |
61 |
Execution timed out |
1078 ms |
94328 KB |
Time limit exceeded |
62 |
Execution timed out |
1077 ms |
94016 KB |
Time limit exceeded |
63 |
Execution timed out |
1080 ms |
94024 KB |
Time limit exceeded |
64 |
Execution timed out |
1088 ms |
93944 KB |
Time limit exceeded |
65 |
Execution timed out |
1075 ms |
93660 KB |
Time limit exceeded |
66 |
Execution timed out |
1072 ms |
93568 KB |
Time limit exceeded |
67 |
Execution timed out |
1079 ms |
93688 KB |
Time limit exceeded |
68 |
Execution timed out |
1102 ms |
93304 KB |
Time limit exceeded |
69 |
Execution timed out |
1078 ms |
93304 KB |
Time limit exceeded |
70 |
Execution timed out |
1079 ms |
75256 KB |
Time limit exceeded |
71 |
Execution timed out |
1084 ms |
93076 KB |
Time limit exceeded |
72 |
Execution timed out |
1078 ms |
93148 KB |
Time limit exceeded |
73 |
Execution timed out |
1072 ms |
93212 KB |
Time limit exceeded |
74 |
Execution timed out |
1071 ms |
93248 KB |
Time limit exceeded |
75 |
Execution timed out |
1080 ms |
92920 KB |
Time limit exceeded |
76 |
Execution timed out |
1077 ms |
92920 KB |
Time limit exceeded |
77 |
Execution timed out |
1077 ms |
92792 KB |
Time limit exceeded |
78 |
Execution timed out |
1076 ms |
92568 KB |
Time limit exceeded |
79 |
Execution timed out |
1087 ms |
92568 KB |
Time limit exceeded |
80 |
Execution timed out |
1086 ms |
92936 KB |
Time limit exceeded |
81 |
Execution timed out |
1083 ms |
92432 KB |
Time limit exceeded |
82 |
Execution timed out |
1084 ms |
92380 KB |
Time limit exceeded |
83 |
Execution timed out |
1086 ms |
92536 KB |
Time limit exceeded |
84 |
Execution timed out |
1078 ms |
92476 KB |
Time limit exceeded |
85 |
Execution timed out |
1082 ms |
92236 KB |
Time limit exceeded |
86 |
Execution timed out |
1073 ms |
92324 KB |
Time limit exceeded |
87 |
Execution timed out |
1078 ms |
92152 KB |
Time limit exceeded |
88 |
Execution timed out |
1092 ms |
92024 KB |
Time limit exceeded |
89 |
Execution timed out |
1085 ms |
92152 KB |
Time limit exceeded |
90 |
Execution timed out |
1067 ms |
74036 KB |
Time limit exceeded |
91 |
Execution timed out |
1072 ms |
92024 KB |
Time limit exceeded |
92 |
Execution timed out |
1079 ms |
91948 KB |
Time limit exceeded |
93 |
Execution timed out |
1080 ms |
91896 KB |
Time limit exceeded |
94 |
Execution timed out |
1065 ms |
91768 KB |
Time limit exceeded |
95 |
Execution timed out |
1078 ms |
91640 KB |
Time limit exceeded |
96 |
Execution timed out |
1081 ms |
91896 KB |
Time limit exceeded |
97 |
Execution timed out |
1084 ms |
91768 KB |
Time limit exceeded |
98 |
Execution timed out |
1085 ms |
91640 KB |
Time limit exceeded |
99 |
Execution timed out |
1072 ms |
91640 KB |
Time limit exceeded |
100 |
Execution timed out |
1083 ms |
91496 KB |
Time limit exceeded |