Submission #523098

# Submission time Handle Problem Language Result Execution time Memory
523098 2022-02-07T04:18:36 Z dostigator Bomb (IZhO17_bomb) C++17
13 / 100
1000 ms 12544 KB
#pragma GCC optimize("O3")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
using namespace std;
#define IShowSpeed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define popcnt __builtin_popcount
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define mii map<int,int>
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define pb push_back
#define vt vector
#define endl '\n'
#define X first
#define Y second
typedef long double ld;
typedef long long ll;
const ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1},N=1e6+10;
const ll mod=1e9+7,inf=1e18;
int dp[N];
void solve(){
    int n,m;
    cin>>n>>m;
    char a[n+2][m+2],c[n+2][m+2];
    for(int i=1; i<=n; ++i) for(int j=1; j<=m; ++j) cin>>a[i][j];
    int ans=0,cnt=0;
    if(n==1){
		for(int i=1; i<=m; ++i) {
			if(a[1][i]=='1') ++cnt;
			else{
				if(cnt>0) ans=min(ans,cnt);
				cnt=0;
			}
		}
		if(a[1][m]=='1') ans=min(ans,cnt);
		cout<<ans<<endl;
		return;
	}
	if(m==1){
		for(int i=1; i<=n; ++i){
			if(a[i][1]=='1') ++cnt;
			else{
				if(cnt>0) ans=min(ans,cnt);
				cnt=0;
			}
		}
		if(a[n][1]=='1') ans=min(ans,cnt);
		cout<<ans<<endl;
		return;
	}
    for(int x=1; x<=n; ++x){
        for(int y=1; y<=m; ++y){
            for(int i=1; i<=n; ++i) for(int j=1; j<=m; ++j) c[i][j]=a[i][j];
            for(int i=1; i<=n; ++i) for(int j=1; j<=m; ++j){
                int bad=1;
                if(i+x-1>n || j+y-1>m) continue;
                for(int ol=i; ol<=i+x-1; ++ol) for(int zhas=j;  zhas<=j+y-1; ++zhas) if(c[ol][zhas]=='0') bad=0;
                if(bad) for(int ol=i; ol<=i+x-1; ++ol) for(int zhas=j;  zhas<=j+y-1; ++zhas) c[ol][zhas]='2';
            }
            int ok=1;
            for(int ol=1; ol<=n; ++ol) for(int zhas=1;  zhas<=m; ++zhas) if(c[ol][zhas]=='1')ok=0;
            if(ok)ans=max(ans,x*y);
        }
    }
    cout<<ans<<endl;
}
int main() {
    IShowSpeed;
    int tt=1;
    //cin>>tt;
    while(tt--) solve();
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Incorrect 0 ms 204 KB Output isn't correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 3 ms 204 KB Output is correct
9 Correct 3 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 3 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 2 ms 204 KB Output is correct
16 Correct 3 ms 204 KB Output is correct
17 Execution timed out 1090 ms 204 KB Time limit exceeded
18 Execution timed out 1086 ms 204 KB Time limit exceeded
19 Execution timed out 1086 ms 332 KB Time limit exceeded
20 Execution timed out 1093 ms 332 KB Time limit exceeded
21 Execution timed out 1092 ms 332 KB Time limit exceeded
22 Execution timed out 1082 ms 332 KB Time limit exceeded
23 Execution timed out 1075 ms 332 KB Time limit exceeded
24 Execution timed out 1078 ms 204 KB Time limit exceeded
25 Execution timed out 1080 ms 332 KB Time limit exceeded
26 Execution timed out 1086 ms 332 KB Time limit exceeded
27 Execution timed out 1083 ms 460 KB Time limit exceeded
28 Execution timed out 1058 ms 460 KB Time limit exceeded
29 Execution timed out 1071 ms 460 KB Time limit exceeded
30 Execution timed out 1077 ms 588 KB Time limit exceeded
31 Execution timed out 1071 ms 588 KB Time limit exceeded
32 Execution timed out 1086 ms 588 KB Time limit exceeded
33 Execution timed out 1086 ms 716 KB Time limit exceeded
34 Execution timed out 1084 ms 460 KB Time limit exceeded
35 Execution timed out 1093 ms 588 KB Time limit exceeded
36 Execution timed out 1052 ms 716 KB Time limit exceeded
37 Correct 3 ms 204 KB Output is correct
38 Execution timed out 1087 ms 12484 KB Time limit exceeded
39 Correct 3 ms 204 KB Output is correct
40 Execution timed out 1086 ms 1740 KB Time limit exceeded
41 Correct 5 ms 204 KB Output is correct
42 Execution timed out 1087 ms 332 KB Time limit exceeded
43 Execution timed out 1052 ms 12496 KB Time limit exceeded
44 Execution timed out 1092 ms 716 KB Time limit exceeded
45 Execution timed out 1092 ms 12492 KB Time limit exceeded
46 Execution timed out 1092 ms 12492 KB Time limit exceeded
47 Execution timed out 1089 ms 12492 KB Time limit exceeded
48 Execution timed out 1084 ms 12492 KB Time limit exceeded
49 Execution timed out 1097 ms 12492 KB Time limit exceeded
50 Execution timed out 1061 ms 12492 KB Time limit exceeded
51 Execution timed out 1079 ms 12492 KB Time limit exceeded
52 Execution timed out 1091 ms 12492 KB Time limit exceeded
53 Execution timed out 1095 ms 12492 KB Time limit exceeded
54 Execution timed out 1087 ms 12492 KB Time limit exceeded
55 Execution timed out 1088 ms 12492 KB Time limit exceeded
56 Execution timed out 1093 ms 12492 KB Time limit exceeded
57 Execution timed out 1086 ms 12492 KB Time limit exceeded
58 Execution timed out 1094 ms 12492 KB Time limit exceeded
59 Execution timed out 1092 ms 12492 KB Time limit exceeded
60 Execution timed out 1085 ms 12492 KB Time limit exceeded
61 Execution timed out 1096 ms 12492 KB Time limit exceeded
62 Execution timed out 1090 ms 12468 KB Time limit exceeded
63 Execution timed out 1095 ms 12492 KB Time limit exceeded
64 Execution timed out 1092 ms 12492 KB Time limit exceeded
65 Execution timed out 1076 ms 12492 KB Time limit exceeded
66 Execution timed out 1089 ms 12492 KB Time limit exceeded
67 Execution timed out 1080 ms 12492 KB Time limit exceeded
68 Execution timed out 1091 ms 12492 KB Time limit exceeded
69 Execution timed out 1079 ms 12492 KB Time limit exceeded
70 Execution timed out 1094 ms 8140 KB Time limit exceeded
71 Execution timed out 1091 ms 12492 KB Time limit exceeded
72 Execution timed out 1089 ms 12492 KB Time limit exceeded
73 Execution timed out 1087 ms 12492 KB Time limit exceeded
74 Execution timed out 1090 ms 12492 KB Time limit exceeded
75 Execution timed out 1094 ms 12544 KB Time limit exceeded
76 Execution timed out 1093 ms 12492 KB Time limit exceeded
77 Execution timed out 1094 ms 12492 KB Time limit exceeded
78 Execution timed out 1082 ms 12492 KB Time limit exceeded
79 Execution timed out 1087 ms 12468 KB Time limit exceeded
80 Execution timed out 1074 ms 12492 KB Time limit exceeded
81 Execution timed out 1090 ms 12492 KB Time limit exceeded
82 Execution timed out 1090 ms 12536 KB Time limit exceeded
83 Execution timed out 1086 ms 12492 KB Time limit exceeded
84 Execution timed out 1052 ms 12492 KB Time limit exceeded
85 Execution timed out 1087 ms 12492 KB Time limit exceeded
86 Execution timed out 1087 ms 12492 KB Time limit exceeded
87 Execution timed out 1072 ms 12492 KB Time limit exceeded
88 Execution timed out 1090 ms 12492 KB Time limit exceeded
89 Execution timed out 1092 ms 12492 KB Time limit exceeded
90 Execution timed out 1093 ms 8140 KB Time limit exceeded
91 Execution timed out 1090 ms 12492 KB Time limit exceeded
92 Execution timed out 1088 ms 12492 KB Time limit exceeded
93 Execution timed out 1093 ms 12492 KB Time limit exceeded
94 Execution timed out 1064 ms 12496 KB Time limit exceeded
95 Execution timed out 1092 ms 12492 KB Time limit exceeded
96 Execution timed out 1097 ms 12492 KB Time limit exceeded
97 Execution timed out 1093 ms 12492 KB Time limit exceeded
98 Execution timed out 1100 ms 12492 KB Time limit exceeded
99 Execution timed out 1091 ms 12492 KB Time limit exceeded
100 Execution timed out 1092 ms 12492 KB Time limit exceeded