#include "towers.h"
#include <vector>
using namespace std;
int n,k;
vector<int>h;
void init(int N, std::vector<int> H) {
n=N;
h=H;
k=0;
for(int i=1;i<n;i++){
if(h[i]>h[i-1]) k=i;
}
}
int max_towers(int L, int R, int D) {
if(L<k && R>k && h[k]-D>=h[L] && h[k]-D>=h[R]) return 2;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
1112 KB |
Output is correct |
2 |
Correct |
698 ms |
1368 KB |
Output is correct |
3 |
Correct |
666 ms |
1364 KB |
Output is correct |
4 |
Correct |
673 ms |
1600 KB |
Output is correct |
5 |
Correct |
649 ms |
1368 KB |
Output is correct |
6 |
Correct |
649 ms |
1368 KB |
Output is correct |
7 |
Correct |
555 ms |
1368 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
460 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
194 ms |
676 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
1112 KB |
Output is correct |
2 |
Correct |
698 ms |
1368 KB |
Output is correct |
3 |
Correct |
666 ms |
1364 KB |
Output is correct |
4 |
Correct |
673 ms |
1600 KB |
Output is correct |
5 |
Correct |
649 ms |
1368 KB |
Output is correct |
6 |
Correct |
649 ms |
1368 KB |
Output is correct |
7 |
Correct |
555 ms |
1368 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |