#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 20;
int cnt_min[maxN];
int H[maxN];
int N;
void init(int _N, vector<int> _H) {
N = _N;
for (int i = 0; i < N; i++) {
H[i] = _H[i];
}
for (int i = 1; i < N - 1; i++) {
cnt_min[i] = cnt_min[i - 1] + (cnt_min[i] < cnt_min[i - 1] && cnt_min[i] < cnt_min[i + 1]);
}
}
int max_towers(int L, int R, int D) {
if (L == R) {
return 1;
}
if (D == 1) {
return cnt_min[R - 1] - cnt_min[L] + (H[L] < H[L + 1]) + (H[R] > H[R - 1]);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
274 ms |
1192 KB |
1st lines differ - on the 1st token, expected: '1', found: '0' |
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: '0' |
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: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
366 ms |
1848 KB |
1st lines differ - on the 1st token, expected: '11903', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
191 ms |
592 KB |
1st lines differ - on the 1st token, expected: '7197', found: '0' |
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: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
274 ms |
1192 KB |
1st lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |