#include <bits/stdc++.h>
using namespace std;
#include "towers.h"
#define pb push_back
#define ll long long
#define fi first
#define se second
int n;
vector<int> tab;
void init(int N, std::vector<int> H) {
n=N;
for (int i = 0; i < N; ++i)
{
tab.pb(H[i]);
}
}
int max_towers(int L, int R, int D){
int dp[n];
int mx=-1;
for (int i = L; i <= R; ++i)
{
dp[i]=1;
for (int j = i-1; j >= L; --j)
{
if(tab[j]<mx-D) dp[i]=max(dp[i],dp[j]+1);
mx=max(mx,tab[j]);
}
}
return dp[R];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4042 ms |
1256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '44' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '44' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4046 ms |
1748 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4066 ms |
856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '44' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4042 ms |
1256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |