#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 |
267 ms |
888 KB |
Output is correct |
2 |
Correct |
529 ms |
1200 KB |
Output is correct |
3 |
Correct |
520 ms |
1200 KB |
Output is correct |
4 |
Correct |
520 ms |
1196 KB |
Output is correct |
5 |
Correct |
514 ms |
1452 KB |
Output is correct |
6 |
Correct |
520 ms |
1192 KB |
Output is correct |
7 |
Correct |
488 ms |
1196 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 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 |
424 ms |
1184 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 |
159 ms |
508 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 |
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 |
267 ms |
888 KB |
Output is correct |
2 |
Correct |
529 ms |
1200 KB |
Output is correct |
3 |
Correct |
520 ms |
1200 KB |
Output is correct |
4 |
Correct |
520 ms |
1196 KB |
Output is correct |
5 |
Correct |
514 ms |
1452 KB |
Output is correct |
6 |
Correct |
520 ms |
1192 KB |
Output is correct |
7 |
Correct |
488 ms |
1196 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 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 |
- |