#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
vector<int> H;
void init(int _N, vector<int> _H) {
N = _N;
H = _H;
}
int max_towers(int L, int R, int D) {
vector<int> dp(N, 1);
for (int i = L; i <= R; i++) {
int mx = 0;
for (int j = i - 1; j >= L; j--) {
if (H[j] + D <= mx && H[i] + D <= mx) {
dp[i] = dp[j] + 1;
break;
}
mx = max(mx, H[j]);
}
}
return *max_element(dp.begin(), dp.end());
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4054 ms |
988 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4045 ms |
1448 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4021 ms |
564 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '12' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4054 ms |
988 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |