#include "towers.h"
#include <algorithm>
#include <vector>
#include <iostream>
#define ll int
#define ff first
#define ss second
#define ln "\n"
using namespace std;
vector<ll> pref, a;
ll n;
vector<bool> big(n);
void init(int N, std::vector<int> H) {
a=H;
n=N;
pref.clear(); pref.resize(n);
big.clear(); big.resize(n);
for (ll i=1; i<n; i++){
pref[i]=pref[i-1];
if (i+1<n and i-1>=0 and a[i]>a[i-1] and a[i]>a[i+1]) pref[i]++;
}
}
// smallt ->
// bigt ->
int max_towers(int L, int R, int D) {
return max(1, (R-1>=0?pref[R-1]:0)-pref[L]+1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
232 ms |
1368 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 |
0 ms |
344 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 |
0 ms |
344 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 |
369 ms |
1880 KB |
Output is correct |
2 |
Correct |
521 ms |
1880 KB |
Output is correct |
3 |
Correct |
514 ms |
1876 KB |
Output is correct |
4 |
Correct |
499 ms |
1880 KB |
Output is correct |
5 |
Correct |
499 ms |
1960 KB |
Output is correct |
6 |
Correct |
506 ms |
1880 KB |
Output is correct |
7 |
Correct |
533 ms |
1880 KB |
Output is correct |
8 |
Correct |
484 ms |
1880 KB |
Output is correct |
9 |
Correct |
572 ms |
1856 KB |
Output is correct |
10 |
Correct |
444 ms |
1880 KB |
Output is correct |
11 |
Correct |
528 ms |
1880 KB |
Output is correct |
12 |
Correct |
506 ms |
1880 KB |
Output is correct |
13 |
Correct |
528 ms |
1852 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
8 ms |
1856 KB |
Output is correct |
18 |
Correct |
12 ms |
1856 KB |
Output is correct |
19 |
Correct |
7 ms |
1880 KB |
Output is correct |
20 |
Correct |
7 ms |
1956 KB |
Output is correct |
21 |
Correct |
12 ms |
1880 KB |
Output is correct |
22 |
Correct |
8 ms |
1880 KB |
Output is correct |
23 |
Correct |
8 ms |
1880 KB |
Output is correct |
24 |
Correct |
7 ms |
1880 KB |
Output is correct |
25 |
Correct |
8 ms |
1968 KB |
Output is correct |
26 |
Correct |
12 ms |
1880 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
145 ms |
788 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 |
0 ms |
344 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 |
232 ms |
1368 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |