#include "towers.h"
#include <vector>
int k;
std::vector<int> arr;
void init(int N, std::vector<int> H) {
for (int i = 1; i < N; i++) {
if (H[i] < H[i - 1]) {
k = i - 1;
break;
}
}
for (int i = 0; i < N; i++) arr.push_back(H[i]);
}
int max_towers(int L, int R, int D) {
if (L >= k || R <= k) return 1;
else {
if (arr[k] - arr[L] >= D && arr[k] - arr[R] >= D) return 2;
else return 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
454 ms |
1040 KB |
Output is correct |
2 |
Correct |
704 ms |
1684 KB |
Output is correct |
3 |
Correct |
764 ms |
1684 KB |
Output is correct |
4 |
Correct |
743 ms |
1672 KB |
Output is correct |
5 |
Correct |
1091 ms |
1672 KB |
Output is correct |
6 |
Correct |
869 ms |
1676 KB |
Output is correct |
7 |
Correct |
744 ms |
1672 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 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 |
208 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 |
699 ms |
1676 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 |
213 ms |
628 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 |
208 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 |
454 ms |
1040 KB |
Output is correct |
2 |
Correct |
704 ms |
1684 KB |
Output is correct |
3 |
Correct |
764 ms |
1684 KB |
Output is correct |
4 |
Correct |
743 ms |
1672 KB |
Output is correct |
5 |
Correct |
1091 ms |
1672 KB |
Output is correct |
6 |
Correct |
869 ms |
1676 KB |
Output is correct |
7 |
Correct |
744 ms |
1672 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |