#include "towers.h"
#include <cassert>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
vector<int> h;
void init(int N, vector<int> H){
h = H;
}
int max_towers(int L, int R, int D){
int score = 0;
for(int i = 0; i < *max_element(h.begin(), h.end()); i ++){
int H = h[i];
int s = 0;
bool good = false;
for(int j = L; j <= R; j ++){
if(!good && h[j] <= H){
s ++;
good = true;
}
else if(good && h[j] >= H + D){
good = false;
}
}
score = max(score, s);
}
return score;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4051 ms |
976 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4089 ms |
1432 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3305 ms |
932 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4051 ms |
976 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |