# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
531870 |
2022-03-01T18:35:43 Z |
nigus |
Bomb (IZhO17_bomb) |
C++14 |
|
1000 ms |
5324 KB |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef unsigned long long ull;
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 eng(seed);
ll random2(){
return (1ll << 31ll)*eng()+eng();
}
ll n,m,k,q,T;
const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod = 998244353;
const int MAXN = 1001;
bool grid[MAXN][MAXN] = {0};
bool covered[MAXN][MAXN] = {0};
bool can_place(int i, int j, int a, int b){
if(n-i < a || m-j < b)return 0;
rep(c1,0,a){
rep(c2,0,b){
if(!grid[i+c1][j+c2])return 0;
}
}
return 1;
}
bool solve(int a, int b){
rep(c1,0,n){
rep(c2,0,m){
if(can_place(c1,c2,a,b)){
//cerr << a << " " << b << ": " << c1+1 << " " << c2+1 << "\n";
rep(c3,0,a){
rep(c4,0,b){
covered[c1+c3][c2+c4] = 1;
}
}
}
}
}
rep(c1,0,n){
rep(c2,0,m){
if(grid[c1][c2] && !covered[c1][c2])return 0;
}
}
return 1;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("fhc.txt","r",stdin);
// freopen("autput.txt","w",stdout);
ll a,b,c,d,e;
cin >> n >> m;
rep(c1,0,n){
string s;
cin >> s;
rep(c2,0,m){
grid[c1][c2] = (s[c2] == '1');
}
}
ll ans = 0;
rep(a,1,n+1){
rep(b,1,m+1){
rep(c1,0,n){
rep(c2,0,m){
covered[c1][c2] = 0;
}
}
if(solve(a, b)){
ans = max(ans, (ll)a*b);
}
}
}
cout << ans << "\n";
return 0;
}
Compilation message
bomb.cpp: In function 'int main()':
bomb.cpp:74:8: warning: unused variable 'a' [-Wunused-variable]
74 | ll a,b,c,d,e;
| ^
bomb.cpp:74:10: warning: unused variable 'b' [-Wunused-variable]
74 | ll a,b,c,d,e;
| ^
bomb.cpp:74:12: warning: unused variable 'c' [-Wunused-variable]
74 | ll a,b,c,d,e;
| ^
bomb.cpp:74:14: warning: unused variable 'd' [-Wunused-variable]
74 | ll a,b,c,d,e;
| ^
bomb.cpp:74:16: warning: unused variable 'e' [-Wunused-variable]
74 | ll a,b,c,d,e;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Runtime error |
2 ms |
2376 KB |
Execution killed with signal 11 |
4 |
Runtime error |
2 ms |
2384 KB |
Execution killed with signal 11 |
5 |
Correct |
213 ms |
332 KB |
Output is correct |
6 |
Correct |
58 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
320 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
3 ms |
332 KB |
Output is correct |
17 |
Correct |
80 ms |
460 KB |
Output is correct |
18 |
Correct |
61 ms |
460 KB |
Output is correct |
19 |
Correct |
208 ms |
500 KB |
Output is correct |
20 |
Correct |
241 ms |
520 KB |
Output is correct |
21 |
Correct |
72 ms |
420 KB |
Output is correct |
22 |
Correct |
147 ms |
464 KB |
Output is correct |
23 |
Correct |
696 ms |
524 KB |
Output is correct |
24 |
Correct |
179 ms |
476 KB |
Output is correct |
25 |
Correct |
943 ms |
520 KB |
Output is correct |
26 |
Execution timed out |
1090 ms |
460 KB |
Time limit exceeded |
27 |
Execution timed out |
1069 ms |
960 KB |
Time limit exceeded |
28 |
Execution timed out |
1089 ms |
972 KB |
Time limit exceeded |
29 |
Execution timed out |
1068 ms |
1100 KB |
Time limit exceeded |
30 |
Execution timed out |
1086 ms |
1356 KB |
Time limit exceeded |
31 |
Execution timed out |
1072 ms |
1108 KB |
Time limit exceeded |
32 |
Execution timed out |
1082 ms |
1228 KB |
Time limit exceeded |
33 |
Execution timed out |
1031 ms |
1356 KB |
Time limit exceeded |
34 |
Execution timed out |
1084 ms |
1112 KB |
Time limit exceeded |
35 |
Execution timed out |
1081 ms |
1356 KB |
Time limit exceeded |
36 |
Execution timed out |
1074 ms |
1356 KB |
Time limit exceeded |
37 |
Correct |
2 ms |
332 KB |
Output is correct |
38 |
Runtime error |
8 ms |
5188 KB |
Execution killed with signal 11 |
39 |
Correct |
2 ms |
320 KB |
Output is correct |
40 |
Execution timed out |
1059 ms |
2680 KB |
Time limit exceeded |
41 |
Correct |
2 ms |
332 KB |
Output is correct |
42 |
Execution timed out |
1072 ms |
464 KB |
Time limit exceeded |
43 |
Runtime error |
7 ms |
5104 KB |
Execution killed with signal 11 |
44 |
Execution timed out |
1037 ms |
1388 KB |
Time limit exceeded |
45 |
Runtime error |
7 ms |
5188 KB |
Execution killed with signal 11 |
46 |
Runtime error |
9 ms |
5192 KB |
Execution killed with signal 11 |
47 |
Runtime error |
7 ms |
5112 KB |
Execution killed with signal 11 |
48 |
Runtime error |
7 ms |
5144 KB |
Execution killed with signal 11 |
49 |
Runtime error |
8 ms |
5164 KB |
Execution killed with signal 11 |
50 |
Runtime error |
8 ms |
5188 KB |
Execution killed with signal 11 |
51 |
Runtime error |
8 ms |
5184 KB |
Execution killed with signal 11 |
52 |
Runtime error |
7 ms |
5188 KB |
Execution killed with signal 11 |
53 |
Runtime error |
7 ms |
5196 KB |
Execution killed with signal 11 |
54 |
Runtime error |
7 ms |
5196 KB |
Execution killed with signal 11 |
55 |
Runtime error |
7 ms |
5212 KB |
Execution killed with signal 11 |
56 |
Runtime error |
7 ms |
5192 KB |
Execution killed with signal 11 |
57 |
Runtime error |
7 ms |
5140 KB |
Execution killed with signal 11 |
58 |
Runtime error |
7 ms |
5100 KB |
Execution killed with signal 11 |
59 |
Runtime error |
7 ms |
5196 KB |
Execution killed with signal 11 |
60 |
Runtime error |
7 ms |
5200 KB |
Execution killed with signal 11 |
61 |
Runtime error |
7 ms |
5208 KB |
Execution killed with signal 11 |
62 |
Runtime error |
8 ms |
5204 KB |
Execution killed with signal 11 |
63 |
Runtime error |
7 ms |
5144 KB |
Execution killed with signal 11 |
64 |
Incorrect |
6 ms |
3912 KB |
Output isn't correct |
65 |
Runtime error |
7 ms |
5184 KB |
Execution killed with signal 11 |
66 |
Runtime error |
7 ms |
5148 KB |
Execution killed with signal 11 |
67 |
Runtime error |
7 ms |
5312 KB |
Execution killed with signal 11 |
68 |
Runtime error |
7 ms |
5200 KB |
Execution killed with signal 11 |
69 |
Runtime error |
7 ms |
5168 KB |
Execution killed with signal 11 |
70 |
Incorrect |
5 ms |
3408 KB |
Output isn't correct |
71 |
Incorrect |
6 ms |
3976 KB |
Output isn't correct |
72 |
Incorrect |
6 ms |
3912 KB |
Output isn't correct |
73 |
Incorrect |
6 ms |
3924 KB |
Output isn't correct |
74 |
Incorrect |
6 ms |
3904 KB |
Output isn't correct |
75 |
Incorrect |
6 ms |
3916 KB |
Output isn't correct |
76 |
Incorrect |
6 ms |
3912 KB |
Output isn't correct |
77 |
Incorrect |
6 ms |
3892 KB |
Output isn't correct |
78 |
Incorrect |
6 ms |
3896 KB |
Output isn't correct |
79 |
Incorrect |
6 ms |
3940 KB |
Output isn't correct |
80 |
Incorrect |
6 ms |
3924 KB |
Output isn't correct |
81 |
Incorrect |
6 ms |
3884 KB |
Output isn't correct |
82 |
Incorrect |
6 ms |
3960 KB |
Output isn't correct |
83 |
Incorrect |
6 ms |
4016 KB |
Output isn't correct |
84 |
Incorrect |
6 ms |
3912 KB |
Output isn't correct |
85 |
Incorrect |
6 ms |
3916 KB |
Output isn't correct |
86 |
Runtime error |
7 ms |
5324 KB |
Execution killed with signal 11 |
87 |
Incorrect |
6 ms |
3912 KB |
Output isn't correct |
88 |
Incorrect |
6 ms |
3980 KB |
Output isn't correct |
89 |
Runtime error |
8 ms |
5160 KB |
Execution killed with signal 11 |
90 |
Runtime error |
7 ms |
4676 KB |
Execution killed with signal 11 |
91 |
Incorrect |
6 ms |
3960 KB |
Output isn't correct |
92 |
Incorrect |
6 ms |
3964 KB |
Output isn't correct |
93 |
Runtime error |
8 ms |
5188 KB |
Execution killed with signal 11 |
94 |
Runtime error |
8 ms |
5124 KB |
Execution killed with signal 11 |
95 |
Incorrect |
6 ms |
3896 KB |
Output isn't correct |
96 |
Incorrect |
5 ms |
3904 KB |
Output isn't correct |
97 |
Runtime error |
8 ms |
5084 KB |
Execution killed with signal 11 |
98 |
Incorrect |
6 ms |
3904 KB |
Output isn't correct |
99 |
Runtime error |
7 ms |
5184 KB |
Execution killed with signal 11 |
100 |
Runtime error |
7 ms |
5188 KB |
Execution killed with signal 11 |