#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#include <vector>
#define int long long
#define pb push_back
#define str string
using namespace std;
int pp[3001];
void solve(){
int n,m;
cin>>n>>m;
if(n>0){
str s[n+3];
int a[n+3][m+3];
int o=0;
int ss=1000000,b=1000000;
for(int i=1;i<=n;i++){
cin>>s[i];
int k=0;
for(int j=0;j<m;j++){
a[i][j+1]=s[i][j]-'0';
if(a[i][j+1]==1){
k++;
pp[j+1]++;
}
else{
if(k>0){
ss=min(ss,k);
k=0;
}
if(pp[j+1]>0){
b=min(b,pp[j+1]);
pp[j+1]=0;
}
}
if(pp[j+1]>0 && i==n){
b=min(b,pp[j+1]);
pp[j+1]=0;
}
}
if(k>0){
ss=min(ss,k);
k=0;
}
}
cout<<ss*b;
}
}
signed main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
//srand( time(0));
//rand()
//freopen("sum.in", "r", stdin);
//freopen("sum.out", "w", stdout);
int tests=1;
//cin>>tests;
for(int i=1;i<=tests;i++){
//cout<<"TEST CASE : "<<i<<"\n";
solve();
}
}
Compilation message
bomb.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
3 | #pragma GCC optimization("unroll-loops")
|
bomb.cpp: In function 'void solve()':
bomb.cpp:21:13: warning: unused variable 'o' [-Wunused-variable]
21 | int o=0;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Incorrect |
1 ms |
352 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
22 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
23 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
24 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
1116 KB |
Output is correct |
28 |
Incorrect |
1 ms |
1368 KB |
Output isn't correct |
29 |
Incorrect |
1 ms |
1628 KB |
Output isn't correct |
30 |
Incorrect |
2 ms |
2140 KB |
Output isn't correct |
31 |
Incorrect |
2 ms |
1884 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
1880 KB |
Output isn't correct |
33 |
Incorrect |
2 ms |
2396 KB |
Output isn't correct |
34 |
Incorrect |
2 ms |
1116 KB |
Output isn't correct |
35 |
Incorrect |
4 ms |
2396 KB |
Output isn't correct |
36 |
Correct |
3 ms |
2260 KB |
Output is correct |
37 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
38 |
Correct |
63 ms |
60508 KB |
Output is correct |
39 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
40 |
Incorrect |
9 ms |
7948 KB |
Output isn't correct |
41 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
43 |
Correct |
68 ms |
60448 KB |
Output is correct |
44 |
Incorrect |
3 ms |
2396 KB |
Output isn't correct |
45 |
Incorrect |
70 ms |
60100 KB |
Output isn't correct |
46 |
Correct |
58 ms |
60388 KB |
Output is correct |
47 |
Incorrect |
59 ms |
60300 KB |
Output isn't correct |
48 |
Incorrect |
57 ms |
60336 KB |
Output isn't correct |
49 |
Correct |
61 ms |
60140 KB |
Output is correct |
50 |
Incorrect |
55 ms |
60484 KB |
Output isn't correct |
51 |
Incorrect |
56 ms |
60388 KB |
Output isn't correct |
52 |
Incorrect |
57 ms |
60228 KB |
Output isn't correct |
53 |
Incorrect |
64 ms |
60416 KB |
Output isn't correct |
54 |
Incorrect |
63 ms |
60240 KB |
Output isn't correct |
55 |
Incorrect |
56 ms |
60176 KB |
Output isn't correct |
56 |
Correct |
55 ms |
60088 KB |
Output is correct |
57 |
Incorrect |
53 ms |
60212 KB |
Output isn't correct |
58 |
Incorrect |
62 ms |
60240 KB |
Output isn't correct |
59 |
Incorrect |
51 ms |
60080 KB |
Output isn't correct |
60 |
Correct |
53 ms |
60504 KB |
Output is correct |
61 |
Correct |
53 ms |
60232 KB |
Output is correct |
62 |
Correct |
54 ms |
60220 KB |
Output is correct |
63 |
Correct |
57 ms |
60240 KB |
Output is correct |
64 |
Correct |
65 ms |
60240 KB |
Output is correct |
65 |
Incorrect |
50 ms |
59892 KB |
Output isn't correct |
66 |
Incorrect |
53 ms |
60392 KB |
Output isn't correct |
67 |
Incorrect |
55 ms |
60200 KB |
Output isn't correct |
68 |
Incorrect |
60 ms |
60248 KB |
Output isn't correct |
69 |
Incorrect |
51 ms |
60168 KB |
Output isn't correct |
70 |
Incorrect |
47 ms |
38540 KB |
Output isn't correct |
71 |
Incorrect |
63 ms |
60316 KB |
Output isn't correct |
72 |
Incorrect |
52 ms |
59912 KB |
Output isn't correct |
73 |
Incorrect |
53 ms |
60160 KB |
Output isn't correct |
74 |
Incorrect |
65 ms |
60392 KB |
Output isn't correct |
75 |
Incorrect |
55 ms |
60420 KB |
Output isn't correct |
76 |
Incorrect |
53 ms |
60176 KB |
Output isn't correct |
77 |
Incorrect |
57 ms |
60424 KB |
Output isn't correct |
78 |
Incorrect |
51 ms |
60204 KB |
Output isn't correct |
79 |
Incorrect |
56 ms |
60140 KB |
Output isn't correct |
80 |
Incorrect |
51 ms |
60096 KB |
Output isn't correct |
81 |
Incorrect |
57 ms |
56020 KB |
Output isn't correct |
82 |
Incorrect |
46 ms |
56144 KB |
Output isn't correct |
83 |
Incorrect |
64 ms |
56136 KB |
Output isn't correct |
84 |
Incorrect |
47 ms |
56148 KB |
Output isn't correct |
85 |
Incorrect |
48 ms |
56148 KB |
Output isn't correct |
86 |
Incorrect |
47 ms |
56100 KB |
Output isn't correct |
87 |
Incorrect |
68 ms |
56148 KB |
Output isn't correct |
88 |
Incorrect |
60 ms |
56144 KB |
Output isn't correct |
89 |
Incorrect |
48 ms |
56148 KB |
Output isn't correct |
90 |
Incorrect |
32 ms |
35928 KB |
Output isn't correct |
91 |
Incorrect |
55 ms |
56152 KB |
Output isn't correct |
92 |
Incorrect |
65 ms |
55972 KB |
Output isn't correct |
93 |
Incorrect |
50 ms |
56144 KB |
Output isn't correct |
94 |
Incorrect |
60 ms |
56100 KB |
Output isn't correct |
95 |
Incorrect |
56 ms |
60240 KB |
Output isn't correct |
96 |
Incorrect |
57 ms |
60368 KB |
Output isn't correct |
97 |
Incorrect |
58 ms |
60176 KB |
Output isn't correct |
98 |
Incorrect |
56 ms |
60140 KB |
Output isn't correct |
99 |
Incorrect |
52 ms |
59984 KB |
Output isn't correct |
100 |
Incorrect |
56 ms |
59772 KB |
Output isn't correct |