#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
int n;
vi H;
void init(int N0, vi H0) {
n = N0;
H = H0;
}
int max_towers(int l, int r, int D) {
int re = 1;
vi DP(n, 1);
for(int i = l; i <= r; ++i) {
for(int j = l; j < i; ++j) {
int ma = 0;
for(int w = j; w <= i; ++w) ma = max(ma, H[w]);
if(ma >= D + max(H[i], H[j])) {
DP[i] = max(DP[i], DP[j] + 1);
re = max(re, DP[i]);
}
}
}
return re;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4065 ms |
1132 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
146 ms |
344 KB |
Output is correct |
3 |
Correct |
97 ms |
428 KB |
Output is correct |
4 |
Correct |
40 ms |
344 KB |
Output is correct |
5 |
Correct |
97 ms |
428 KB |
Output is correct |
6 |
Correct |
6 ms |
344 KB |
Output is correct |
7 |
Correct |
59 ms |
428 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
11 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
69 ms |
344 KB |
Output is correct |
14 |
Correct |
39 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
344 KB |
Output is correct |
16 |
Correct |
346 ms |
344 KB |
Output is correct |
17 |
Correct |
20 ms |
700 KB |
Output is correct |
18 |
Correct |
5 ms |
344 KB |
Output is correct |
19 |
Correct |
20 ms |
456 KB |
Output is correct |
20 |
Correct |
889 ms |
432 KB |
Output is correct |
21 |
Correct |
921 ms |
344 KB |
Output is correct |
22 |
Correct |
870 ms |
344 KB |
Output is correct |
23 |
Correct |
898 ms |
432 KB |
Output is correct |
24 |
Correct |
880 ms |
344 KB |
Output is correct |
25 |
Correct |
79 ms |
416 KB |
Output is correct |
26 |
Correct |
863 ms |
592 KB |
Output is correct |
27 |
Correct |
880 ms |
424 KB |
Output is correct |
28 |
Correct |
887 ms |
344 KB |
Output is correct |
29 |
Correct |
873 ms |
344 KB |
Output is correct |
30 |
Correct |
871 ms |
444 KB |
Output is correct |
31 |
Correct |
878 ms |
344 KB |
Output is correct |
32 |
Correct |
861 ms |
432 KB |
Output is correct |
33 |
Correct |
860 ms |
344 KB |
Output is correct |
34 |
Correct |
862 ms |
344 KB |
Output is correct |
35 |
Correct |
876 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
146 ms |
344 KB |
Output is correct |
3 |
Correct |
97 ms |
428 KB |
Output is correct |
4 |
Correct |
40 ms |
344 KB |
Output is correct |
5 |
Correct |
97 ms |
428 KB |
Output is correct |
6 |
Correct |
6 ms |
344 KB |
Output is correct |
7 |
Correct |
59 ms |
428 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
11 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
69 ms |
344 KB |
Output is correct |
14 |
Correct |
39 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
344 KB |
Output is correct |
16 |
Correct |
346 ms |
344 KB |
Output is correct |
17 |
Correct |
20 ms |
700 KB |
Output is correct |
18 |
Correct |
5 ms |
344 KB |
Output is correct |
19 |
Correct |
20 ms |
456 KB |
Output is correct |
20 |
Correct |
889 ms |
432 KB |
Output is correct |
21 |
Correct |
921 ms |
344 KB |
Output is correct |
22 |
Correct |
870 ms |
344 KB |
Output is correct |
23 |
Correct |
898 ms |
432 KB |
Output is correct |
24 |
Correct |
880 ms |
344 KB |
Output is correct |
25 |
Correct |
79 ms |
416 KB |
Output is correct |
26 |
Correct |
863 ms |
592 KB |
Output is correct |
27 |
Correct |
880 ms |
424 KB |
Output is correct |
28 |
Correct |
887 ms |
344 KB |
Output is correct |
29 |
Correct |
873 ms |
344 KB |
Output is correct |
30 |
Correct |
871 ms |
444 KB |
Output is correct |
31 |
Correct |
878 ms |
344 KB |
Output is correct |
32 |
Correct |
861 ms |
432 KB |
Output is correct |
33 |
Correct |
860 ms |
344 KB |
Output is correct |
34 |
Correct |
862 ms |
344 KB |
Output is correct |
35 |
Correct |
876 ms |
340 KB |
Output is correct |
36 |
Execution timed out |
4050 ms |
1112 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4064 ms |
1492 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4057 ms |
600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
146 ms |
344 KB |
Output is correct |
3 |
Correct |
97 ms |
428 KB |
Output is correct |
4 |
Correct |
40 ms |
344 KB |
Output is correct |
5 |
Correct |
97 ms |
428 KB |
Output is correct |
6 |
Correct |
6 ms |
344 KB |
Output is correct |
7 |
Correct |
59 ms |
428 KB |
Output is correct |
8 |
Correct |
2 ms |
344 KB |
Output is correct |
9 |
Correct |
11 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
69 ms |
344 KB |
Output is correct |
14 |
Correct |
39 ms |
344 KB |
Output is correct |
15 |
Correct |
2 ms |
344 KB |
Output is correct |
16 |
Correct |
346 ms |
344 KB |
Output is correct |
17 |
Correct |
20 ms |
700 KB |
Output is correct |
18 |
Correct |
5 ms |
344 KB |
Output is correct |
19 |
Correct |
20 ms |
456 KB |
Output is correct |
20 |
Correct |
889 ms |
432 KB |
Output is correct |
21 |
Correct |
921 ms |
344 KB |
Output is correct |
22 |
Correct |
870 ms |
344 KB |
Output is correct |
23 |
Correct |
898 ms |
432 KB |
Output is correct |
24 |
Correct |
880 ms |
344 KB |
Output is correct |
25 |
Correct |
79 ms |
416 KB |
Output is correct |
26 |
Correct |
863 ms |
592 KB |
Output is correct |
27 |
Correct |
880 ms |
424 KB |
Output is correct |
28 |
Correct |
887 ms |
344 KB |
Output is correct |
29 |
Correct |
873 ms |
344 KB |
Output is correct |
30 |
Correct |
871 ms |
444 KB |
Output is correct |
31 |
Correct |
878 ms |
344 KB |
Output is correct |
32 |
Correct |
861 ms |
432 KB |
Output is correct |
33 |
Correct |
860 ms |
344 KB |
Output is correct |
34 |
Correct |
862 ms |
344 KB |
Output is correct |
35 |
Correct |
876 ms |
340 KB |
Output is correct |
36 |
Execution timed out |
4050 ms |
1112 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4065 ms |
1132 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |