#include "towers.h"
#include <vector>
#include <set>
using namespace std;
vector<int>h;
int n;
void init(int N, std::vector<int> H) {
n=N;h=H;
}
int max_towers(int L, int R, int D) {
set<int> visited;
int ans = 0;
for(int i=L;i<R+1;i++){
if(visited.count(i))continue;
int l=i;
int cnt = 0;
while(true){
visited.insert(l);
if(l == n-2)break;
if(h[l]<=(h[l+1]-D) and h[l+2]<=(h[l+1]-D)){
cnt++;
l+=2;
}else{
break;
}
}
ans = max(ans,cnt);
}
return ans+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4091 ms |
3444 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4082 ms |
5628 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4009 ms |
1488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4091 ms |
3444 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |