#include "towers.h"
#include <vector>
using namespace std;
int valley[100100];
vector<int>H;
void init(int N, std::vector<int> H_) {
H=H_;
for(int i=1;i<N;i++)
valley[i]=valley[i-1]+(H[i]<H[i-1]&&H[i]<H[i+1]);
}
int max_towers(int l, int r, int D) {
if(l==r) return 1;
return (H[l]<H[l+1])+(H[r-1]>H[r])+valley[r-1]-valley[l];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
237 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 |
363 ms |
1880 KB |
Output is correct |
2 |
Correct |
521 ms |
1880 KB |
Output is correct |
3 |
Correct |
476 ms |
1880 KB |
Output is correct |
4 |
Correct |
494 ms |
1880 KB |
Output is correct |
5 |
Correct |
485 ms |
1880 KB |
Output is correct |
6 |
Correct |
480 ms |
1880 KB |
Output is correct |
7 |
Correct |
519 ms |
1880 KB |
Output is correct |
8 |
Correct |
472 ms |
1880 KB |
Output is correct |
9 |
Correct |
428 ms |
1880 KB |
Output is correct |
10 |
Correct |
484 ms |
1880 KB |
Output is correct |
11 |
Correct |
518 ms |
1880 KB |
Output is correct |
12 |
Correct |
500 ms |
1880 KB |
Output is correct |
13 |
Correct |
515 ms |
1880 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
7 ms |
1848 KB |
Output is correct |
18 |
Correct |
8 ms |
1880 KB |
Output is correct |
19 |
Correct |
7 ms |
1840 KB |
Output is correct |
20 |
Correct |
7 ms |
1880 KB |
Output is correct |
21 |
Correct |
8 ms |
1880 KB |
Output is correct |
22 |
Correct |
8 ms |
1880 KB |
Output is correct |
23 |
Correct |
7 ms |
1880 KB |
Output is correct |
24 |
Correct |
7 ms |
1952 KB |
Output is correct |
25 |
Correct |
7 ms |
1856 KB |
Output is correct |
26 |
Correct |
7 ms |
1860 KB |
Output is correct |
27 |
Correct |
0 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
1 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 |
138 ms |
776 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 |
237 ms |
1368 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |