#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> arr;
int cnt[101010];
void init(int N, vector<int> H) {
n = N;
for (int i = 0; i < N; i++) arr.push_back(H[i]);
cnt[0] = 0;
for (int i = 1; i < N - 1; i++) {
if (arr[i] > arr[i - 1] && arr[i] > arr[i + 1]) cnt[i] = cnt[i - 1] + 1;
else cnt[i] = cnt[i - 1];
}
}
int max_towers(int L, int R, int D) {
return max(cnt[R - 1] - cnt[L], 0) + 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
385 ms |
1300 KB |
2nd 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: '16' |
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: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
729 ms |
1948 KB |
Output is correct |
2 |
Correct |
798 ms |
1948 KB |
Output is correct |
3 |
Correct |
1127 ms |
1948 KB |
Output is correct |
4 |
Correct |
993 ms |
1992 KB |
Output is correct |
5 |
Correct |
1169 ms |
1944 KB |
Output is correct |
6 |
Correct |
899 ms |
1992 KB |
Output is correct |
7 |
Correct |
574 ms |
1928 KB |
Output is correct |
8 |
Correct |
1056 ms |
1912 KB |
Output is correct |
9 |
Correct |
1177 ms |
1960 KB |
Output is correct |
10 |
Correct |
857 ms |
1980 KB |
Output is correct |
11 |
Correct |
1033 ms |
1960 KB |
Output is correct |
12 |
Correct |
688 ms |
1992 KB |
Output is correct |
13 |
Correct |
890 ms |
1948 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
14 ms |
1960 KB |
Output is correct |
18 |
Correct |
14 ms |
1964 KB |
Output is correct |
19 |
Correct |
13 ms |
1936 KB |
Output is correct |
20 |
Correct |
20 ms |
1944 KB |
Output is correct |
21 |
Correct |
14 ms |
1952 KB |
Output is correct |
22 |
Correct |
23 ms |
1976 KB |
Output is correct |
23 |
Correct |
13 ms |
1984 KB |
Output is correct |
24 |
Correct |
13 ms |
1956 KB |
Output is correct |
25 |
Correct |
13 ms |
1944 KB |
Output is correct |
26 |
Correct |
12 ms |
1956 KB |
Output is correct |
27 |
Correct |
1 ms |
336 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
284 ms |
772 KB |
1st lines differ - on the 1st token, expected: '7197', found: '8004' |
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: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
385 ms |
1300 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |