#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int N, p;
vector<int> H;
void init(int n, vector<int> h) {
N = n, H = h;
for (int i = 0; i < N; i++) {
if ((i == 0 || H[i] > H[i - 1]) && (i == N - 1 || H[i] > H[i + 1])) {
p = i;
}
}
}
int max_towers(int L, int R, int D) {
int l = upper_bound(H.begin(), H.end(), H[p] - D) - H.begin() - 1;
int r = lower_bound(H.begin(), H.end(), H[p] - D, [&](int x, int y) {return x >= y;}) - H.begin() - 1;
return (L <= l && r <= R) ? 2 : 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
284 ms |
976 KB |
1st lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
1 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 |
492 ms |
1460 KB |
1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
208 ms |
556 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 |
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 |
284 ms |
976 KB |
1st lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |