# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
168972 |
2019-12-17T10:33:44 Z |
abil |
Bomb (IZhO17_bomb) |
C++14 |
|
1000 ms |
106368 KB |
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define all(s) s.begin(),s.end()
//#define int long long
using namespace std;
const int N = (2500 + 12);
const int mod = (1e9 + 7);
const int INF = (0x3f3f3f3f);
char a[N][N];
int up[N][N], down[N][N], leftt[N][N], rightt[N][N];
int n, m;
bool solve(int x,int y){
for(int i = 1;i <= n; i++){
for(int j = 1;j <= m; j++){
if(a[i][j] == '1'){
if(up[i][j] + down[i][j] - 1 < x || leftt[i][j] + rightt[i][j] - 1 < y){
return false;
}
}
}
}
return true;
}
main()
{
cin >> n >> m;
for(int i = 1;i <= n; i++){
for(int j = 1;j <= m; j++){
cin >> a[i][j];
}
}
for(int i = 1;i <= n; i++){
int cnt = 0;
for(int j = 1;j <= m; j++){
cnt = (a[i][j] == '0' ? 0 : cnt + 1);
leftt[i][j] = cnt;
}
}
for(int i = 1;i <= n; i++){
int cnt = 0;
for(int j = m;j >= 1; j--){
cnt = (a[i][j] == '0' ? 0 : cnt + 1);
rightt[i][j] = cnt;
}
}
for(int i = 1;i <= m; i++){
int cnt = 0;
for(int j = 1;j <= n; j++){
cnt = (a[j][i] == '0' ? 0 : cnt + 1);
up[j][i] = cnt;
}
}
for(int i = 1;i <= m; i++){
int cnt = 0;
for(int j = n;j >= 1; j--){
cnt = (a[j][i] == '0' ? 0 : cnt + 1);
down[j][i] = cnt;
}
}
int ans = 1;
for(int i = 1;i <= n; i++){
for(int j = 1;j <= m; j++){
if(solve(i,j)){
ans = max(ans, i * j);
}
}
}
cout << ans;
}
Compilation message
bomb.cpp:33:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main()
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
760 KB |
Output is correct |
3 |
Correct |
86 ms |
46712 KB |
Output is correct |
4 |
Correct |
53 ms |
46712 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 |
504 KB |
Output is correct |
8 |
Incorrect |
2 ms |
764 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
632 KB |
Output isn't correct |
13 |
Correct |
2 ms |
632 KB |
Output is correct |
14 |
Correct |
2 ms |
632 KB |
Output is correct |
15 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
16 |
Correct |
2 ms |
764 KB |
Output is correct |
17 |
Correct |
4 ms |
1656 KB |
Output is correct |
18 |
Incorrect |
3 ms |
1656 KB |
Output isn't correct |
19 |
Incorrect |
6 ms |
2168 KB |
Output isn't correct |
20 |
Incorrect |
7 ms |
2168 KB |
Output isn't correct |
21 |
Incorrect |
3 ms |
1400 KB |
Output isn't correct |
22 |
Incorrect |
4 ms |
1784 KB |
Output isn't correct |
23 |
Incorrect |
13 ms |
2296 KB |
Output isn't correct |
24 |
Incorrect |
6 ms |
1912 KB |
Output isn't correct |
25 |
Incorrect |
20 ms |
2424 KB |
Output isn't correct |
26 |
Correct |
9 ms |
2296 KB |
Output is correct |
27 |
Correct |
17 ms |
7032 KB |
Output is correct |
28 |
Incorrect |
24 ms |
7544 KB |
Output isn't correct |
29 |
Execution timed out |
1072 ms |
9720 KB |
Time limit exceeded |
30 |
Execution timed out |
1080 ms |
11384 KB |
Time limit exceeded |
31 |
Execution timed out |
1077 ms |
9080 KB |
Time limit exceeded |
32 |
Execution timed out |
1076 ms |
10364 KB |
Time limit exceeded |
33 |
Execution timed out |
1080 ms |
12024 KB |
Time limit exceeded |
34 |
Incorrect |
24 ms |
8312 KB |
Output isn't correct |
35 |
Incorrect |
502 ms |
12024 KB |
Output isn't correct |
36 |
Execution timed out |
1085 ms |
12024 KB |
Time limit exceeded |
37 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
38 |
Execution timed out |
1085 ms |
106048 KB |
Time limit exceeded |
39 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
40 |
Execution timed out |
1079 ms |
29304 KB |
Time limit exceeded |
41 |
Incorrect |
2 ms |
760 KB |
Output isn't correct |
42 |
Incorrect |
50 ms |
2552 KB |
Output isn't correct |
43 |
Execution timed out |
1093 ms |
106296 KB |
Time limit exceeded |
44 |
Execution timed out |
1056 ms |
12024 KB |
Time limit exceeded |
45 |
Execution timed out |
1095 ms |
106232 KB |
Time limit exceeded |
46 |
Execution timed out |
1079 ms |
106200 KB |
Time limit exceeded |
47 |
Execution timed out |
1081 ms |
106244 KB |
Time limit exceeded |
48 |
Execution timed out |
1088 ms |
106172 KB |
Time limit exceeded |
49 |
Execution timed out |
1085 ms |
106148 KB |
Time limit exceeded |
50 |
Execution timed out |
1084 ms |
106108 KB |
Time limit exceeded |
51 |
Execution timed out |
1087 ms |
106112 KB |
Time limit exceeded |
52 |
Execution timed out |
1086 ms |
106196 KB |
Time limit exceeded |
53 |
Execution timed out |
1087 ms |
106260 KB |
Time limit exceeded |
54 |
Execution timed out |
1087 ms |
106164 KB |
Time limit exceeded |
55 |
Execution timed out |
1094 ms |
106136 KB |
Time limit exceeded |
56 |
Execution timed out |
1089 ms |
106104 KB |
Time limit exceeded |
57 |
Execution timed out |
1074 ms |
106244 KB |
Time limit exceeded |
58 |
Execution timed out |
1088 ms |
106136 KB |
Time limit exceeded |
59 |
Execution timed out |
1096 ms |
106036 KB |
Time limit exceeded |
60 |
Execution timed out |
1089 ms |
106116 KB |
Time limit exceeded |
61 |
Execution timed out |
1092 ms |
106104 KB |
Time limit exceeded |
62 |
Execution timed out |
1087 ms |
106096 KB |
Time limit exceeded |
63 |
Execution timed out |
1088 ms |
106080 KB |
Time limit exceeded |
64 |
Execution timed out |
1088 ms |
106104 KB |
Time limit exceeded |
65 |
Execution timed out |
1087 ms |
106224 KB |
Time limit exceeded |
66 |
Execution timed out |
1093 ms |
106108 KB |
Time limit exceeded |
67 |
Execution timed out |
1096 ms |
106104 KB |
Time limit exceeded |
68 |
Execution timed out |
1088 ms |
106200 KB |
Time limit exceeded |
69 |
Execution timed out |
1088 ms |
106276 KB |
Time limit exceeded |
70 |
Execution timed out |
1088 ms |
85368 KB |
Time limit exceeded |
71 |
Execution timed out |
1098 ms |
106144 KB |
Time limit exceeded |
72 |
Execution timed out |
1079 ms |
106140 KB |
Time limit exceeded |
73 |
Execution timed out |
1097 ms |
106352 KB |
Time limit exceeded |
74 |
Execution timed out |
1097 ms |
106232 KB |
Time limit exceeded |
75 |
Execution timed out |
1087 ms |
106196 KB |
Time limit exceeded |
76 |
Execution timed out |
1099 ms |
106104 KB |
Time limit exceeded |
77 |
Execution timed out |
1078 ms |
106104 KB |
Time limit exceeded |
78 |
Execution timed out |
1086 ms |
106160 KB |
Time limit exceeded |
79 |
Execution timed out |
1083 ms |
106104 KB |
Time limit exceeded |
80 |
Execution timed out |
1092 ms |
105976 KB |
Time limit exceeded |
81 |
Execution timed out |
1092 ms |
106196 KB |
Time limit exceeded |
82 |
Execution timed out |
1089 ms |
106016 KB |
Time limit exceeded |
83 |
Execution timed out |
1088 ms |
106104 KB |
Time limit exceeded |
84 |
Execution timed out |
1086 ms |
106104 KB |
Time limit exceeded |
85 |
Execution timed out |
1084 ms |
106068 KB |
Time limit exceeded |
86 |
Execution timed out |
1071 ms |
106044 KB |
Time limit exceeded |
87 |
Execution timed out |
1086 ms |
105912 KB |
Time limit exceeded |
88 |
Execution timed out |
1091 ms |
106208 KB |
Time limit exceeded |
89 |
Execution timed out |
1081 ms |
106284 KB |
Time limit exceeded |
90 |
Execution timed out |
1089 ms |
85536 KB |
Time limit exceeded |
91 |
Execution timed out |
1085 ms |
106244 KB |
Time limit exceeded |
92 |
Execution timed out |
1083 ms |
106368 KB |
Time limit exceeded |
93 |
Execution timed out |
1095 ms |
106144 KB |
Time limit exceeded |
94 |
Execution timed out |
1084 ms |
106312 KB |
Time limit exceeded |
95 |
Execution timed out |
1088 ms |
106264 KB |
Time limit exceeded |
96 |
Execution timed out |
1079 ms |
106240 KB |
Time limit exceeded |
97 |
Execution timed out |
1068 ms |
106132 KB |
Time limit exceeded |
98 |
Execution timed out |
1088 ms |
106236 KB |
Time limit exceeded |
99 |
Execution timed out |
1078 ms |
106080 KB |
Time limit exceeded |
100 |
Execution timed out |
1090 ms |
106016 KB |
Time limit exceeded |