#include "towers.h"
#include <vector>
std::vector<int> H;
int m;
void init(int N, std::vector<int> _H) {
H = std::move(_H);
for(m=0;m<N&&H[m+1]>H[m];m++);
}
int max_towers(int L, int R, int D) {
if(L >= m || R <= m) return 1;
auto a = H[L];
auto b = H[R];
auto c = H[m];
if(a < c-D && b < c-D) return 2;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
289 ms |
884 KB |
Output is correct |
2 |
Correct |
557 ms |
1200 KB |
Output is correct |
3 |
Correct |
564 ms |
1192 KB |
Output is correct |
4 |
Correct |
542 ms |
1212 KB |
Output is correct |
5 |
Correct |
511 ms |
1204 KB |
Output is correct |
6 |
Correct |
565 ms |
1188 KB |
Output is correct |
7 |
Correct |
481 ms |
1200 KB |
Output is correct |
8 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
9 |
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: '1' |
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: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
416 ms |
1208 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 |
164 ms |
852 KB |
1st lines differ - on the 1st token, expected: '7197', found: '1' |
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: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
289 ms |
884 KB |
Output is correct |
2 |
Correct |
557 ms |
1200 KB |
Output is correct |
3 |
Correct |
564 ms |
1192 KB |
Output is correct |
4 |
Correct |
542 ms |
1212 KB |
Output is correct |
5 |
Correct |
511 ms |
1204 KB |
Output is correct |
6 |
Correct |
565 ms |
1188 KB |
Output is correct |
7 |
Correct |
481 ms |
1200 KB |
Output is correct |
8 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '2', found: '1' |
9 |
Halted |
0 ms |
0 KB |
- |