# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
337915 |
2020-12-22T05:48:16 Z |
BY_KUTBILIM |
Bomb (IZhO17_bomb) |
C++14 |
|
1000 ms |
89040 KB |
/** @BY_KUTBILIM **/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define all(x) ((x).begin(), (x).end())
#define rall(x) ((x).rbegin(), (x).end())
const int inf = (int)1e9+7;
int up[2505][2505], down[2505][2505];
int main(){
ios_base::sync_with_stdio(false);
cin.tie();
int n, m;
cin >> n >> m;
bool a[n][m];
char ch;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> ch;
a[i][j] = bool(ch - '0');
}
}
int W = m, H = n, len;
for(int i = 0; i < n; i++){
len = 0;
for(int j = 0; j < m; j++){
if(a[i][j])len++;
else{
if(len)W = min(W, len);
len = 0;
}
}
if(len)W = min(W, len);
}
for(int j = 0; j < m; j++){
len = 0;
for(int i = 0; i < n; i++){
if(a[i][j])len++;
else{
if(len)H = min(H, len);
len = 0;
}
}
if(len)H = min(H, len);
}
for(int j = 0; j < m; j++){
for(int i = 0; i < n; i++){
if(a[i][j]){
up[i][j] = (i ? up[i-1][j] : 0) + 1;
}
}
for(int i = n - 1; i >= 0; i--){
if(a[i][j]){
down[i][j] = (i < n - 1 ? down[i+1][j] : 0) + 1;
}
}
}
vector<int> ans(2510, H);
int l, r;
for(int i = 0; i < n; i++){
l = inf, r = inf, len = 0;
for(int j = 0; j < m; j++){
if(a[i][j]){
r = min(r, up[i][j]);
l = min(l, down[i][j]);
ans[len] = min(ans[len], r + l - 1);
len++;
} else len = 0, l = inf, r = inf;
}
l = inf, r = inf, len = 0;
for(int j = m - 1; j >= 0; j--){
if(a[i][j]){
r = min(r, up[i][j]);
l = min(l, down[i][j]);
ans[len] = min(ans[len], r + l - 1);
len++;
} else len = 0, l = inf, r = inf;
}
}
int res = ans[0];
for(int i = 1; i < W; i++){
ans[i] = min(ans[i], ans[i-1]);
res = max(res, ans[i] * (i+1));
}
//cout << res;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << up[i][j] << " ";
}
cout << endl;
}
cout << endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < m ; j++){
cout << down[i][j] << " ";
}
cout << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
3 |
Incorrect |
22 ms |
20460 KB |
Output isn't correct |
4 |
Incorrect |
23 ms |
20460 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
524 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
17 |
Incorrect |
2 ms |
876 KB |
Output isn't correct |
18 |
Incorrect |
2 ms |
620 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
876 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
876 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
492 KB |
Output isn't correct |
22 |
Incorrect |
2 ms |
748 KB |
Output isn't correct |
23 |
Incorrect |
3 ms |
876 KB |
Output isn't correct |
24 |
Incorrect |
3 ms |
876 KB |
Output isn't correct |
25 |
Incorrect |
4 ms |
1132 KB |
Output isn't correct |
26 |
Incorrect |
4 ms |
1260 KB |
Output isn't correct |
27 |
Incorrect |
20 ms |
4076 KB |
Output isn't correct |
28 |
Incorrect |
24 ms |
1388 KB |
Output isn't correct |
29 |
Incorrect |
30 ms |
5376 KB |
Output isn't correct |
30 |
Incorrect |
41 ms |
4332 KB |
Output isn't correct |
31 |
Incorrect |
33 ms |
3180 KB |
Output isn't correct |
32 |
Incorrect |
34 ms |
4076 KB |
Output isn't correct |
33 |
Incorrect |
44 ms |
5484 KB |
Output isn't correct |
34 |
Incorrect |
23 ms |
1280 KB |
Output isn't correct |
35 |
Incorrect |
42 ms |
1900 KB |
Output isn't correct |
36 |
Incorrect |
48 ms |
7276 KB |
Output isn't correct |
37 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
38 |
Execution timed out |
1097 ms |
88940 KB |
Time limit exceeded |
39 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
40 |
Incorrect |
184 ms |
20076 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
42 |
Incorrect |
4 ms |
1260 KB |
Output isn't correct |
43 |
Execution timed out |
1096 ms |
77164 KB |
Time limit exceeded |
44 |
Incorrect |
46 ms |
6380 KB |
Output isn't correct |
45 |
Execution timed out |
1094 ms |
81408 KB |
Time limit exceeded |
46 |
Execution timed out |
1103 ms |
75500 KB |
Time limit exceeded |
47 |
Execution timed out |
1098 ms |
82028 KB |
Time limit exceeded |
48 |
Execution timed out |
1098 ms |
83000 KB |
Time limit exceeded |
49 |
Execution timed out |
1095 ms |
87788 KB |
Time limit exceeded |
50 |
Execution timed out |
1091 ms |
82924 KB |
Time limit exceeded |
51 |
Execution timed out |
1096 ms |
83400 KB |
Time limit exceeded |
52 |
Execution timed out |
1094 ms |
82792 KB |
Time limit exceeded |
53 |
Execution timed out |
1097 ms |
82268 KB |
Time limit exceeded |
54 |
Execution timed out |
1093 ms |
68264 KB |
Time limit exceeded |
55 |
Execution timed out |
1060 ms |
65448 KB |
Time limit exceeded |
56 |
Execution timed out |
1085 ms |
88812 KB |
Time limit exceeded |
57 |
Execution timed out |
1084 ms |
61084 KB |
Time limit exceeded |
58 |
Execution timed out |
1100 ms |
66668 KB |
Time limit exceeded |
59 |
Execution timed out |
1090 ms |
63468 KB |
Time limit exceeded |
60 |
Execution timed out |
1047 ms |
74732 KB |
Time limit exceeded |
61 |
Execution timed out |
1097 ms |
89040 KB |
Time limit exceeded |
62 |
Execution timed out |
1097 ms |
87112 KB |
Time limit exceeded |
63 |
Execution timed out |
1054 ms |
87008 KB |
Time limit exceeded |
64 |
Execution timed out |
1043 ms |
62316 KB |
Time limit exceeded |
65 |
Execution timed out |
1045 ms |
79652 KB |
Time limit exceeded |
66 |
Execution timed out |
1052 ms |
76408 KB |
Time limit exceeded |
67 |
Execution timed out |
1051 ms |
79444 KB |
Time limit exceeded |
68 |
Execution timed out |
1050 ms |
81772 KB |
Time limit exceeded |
69 |
Execution timed out |
1095 ms |
60780 KB |
Time limit exceeded |
70 |
Incorrect |
845 ms |
31784 KB |
Output isn't correct |
71 |
Execution timed out |
1088 ms |
50656 KB |
Time limit exceeded |
72 |
Execution timed out |
1089 ms |
56908 KB |
Time limit exceeded |
73 |
Execution timed out |
1070 ms |
57020 KB |
Time limit exceeded |
74 |
Execution timed out |
1041 ms |
56488 KB |
Time limit exceeded |
75 |
Execution timed out |
1048 ms |
60140 KB |
Time limit exceeded |
76 |
Execution timed out |
1090 ms |
62704 KB |
Time limit exceeded |
77 |
Execution timed out |
1052 ms |
61940 KB |
Time limit exceeded |
78 |
Execution timed out |
1095 ms |
62572 KB |
Time limit exceeded |
79 |
Execution timed out |
1053 ms |
31340 KB |
Time limit exceeded |
80 |
Execution timed out |
1089 ms |
33472 KB |
Time limit exceeded |
81 |
Execution timed out |
1084 ms |
34644 KB |
Time limit exceeded |
82 |
Execution timed out |
1060 ms |
64876 KB |
Time limit exceeded |
83 |
Execution timed out |
1062 ms |
64852 KB |
Time limit exceeded |
84 |
Execution timed out |
1093 ms |
27980 KB |
Time limit exceeded |
85 |
Execution timed out |
1095 ms |
64404 KB |
Time limit exceeded |
86 |
Execution timed out |
1094 ms |
85100 KB |
Time limit exceeded |
87 |
Execution timed out |
1066 ms |
62704 KB |
Time limit exceeded |
88 |
Execution timed out |
1087 ms |
65336 KB |
Time limit exceeded |
89 |
Execution timed out |
1094 ms |
75756 KB |
Time limit exceeded |
90 |
Incorrect |
940 ms |
48388 KB |
Output isn't correct |
91 |
Execution timed out |
1095 ms |
68340 KB |
Time limit exceeded |
92 |
Execution timed out |
1064 ms |
69608 KB |
Time limit exceeded |
93 |
Execution timed out |
1049 ms |
81740 KB |
Time limit exceeded |
94 |
Execution timed out |
1045 ms |
72172 KB |
Time limit exceeded |
95 |
Execution timed out |
1090 ms |
66156 KB |
Time limit exceeded |
96 |
Execution timed out |
1092 ms |
66284 KB |
Time limit exceeded |
97 |
Execution timed out |
1092 ms |
86616 KB |
Time limit exceeded |
98 |
Execution timed out |
1097 ms |
66668 KB |
Time limit exceeded |
99 |
Execution timed out |
1091 ms |
73324 KB |
Time limit exceeded |
100 |
Execution timed out |
1096 ms |
84588 KB |
Time limit exceeded |