#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
const int N = (int)1e5 + 10;
int h[N];
void init(int n, vector<int> H) {
for(int i = 0 ; i < n; i ++ ){
h[i] = H[i];
}
}
int D;
int fin(int l, int r, int lim){
if(l > r) return 0;
int mx = -1;
for(int i = l; i <= r; i ++ ){
if(h[i] <= lim){
if(mx == -1 || h[i] > h[mx]){
mx = i;
}
}
}
if(mx == -1) return 0;
return max(1, fin(l,mx-1,h[mx]-D) + fin(mx+1,r,h[mx]-D));
}
int max_towers(int L, int R, int delta) {
D = delta;
return fin(L,R,(int)1e9 + 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4054 ms |
976 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: '11' |
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: '11' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4025 ms |
1332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4072 ms |
464 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: '11' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4054 ms |
976 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |