#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=1e5+5;
int n, qs[nx];
vector<int> h;
void init(int N, std::vector<int> H) {
n=N;
h=H;
for (int i=1; i<N-1; i++) if (h[i]<h[i-1]&&h[i]<h[i+1]) qs[i]++;
for (int i=1; i<N; i++) qs[i]+=qs[i-1];
}
int max_towers(int L, int R, int D) {
if (L==R) return 1;
return qs[R-1]-qs[L]+(h[L]<h[L+1])+(h[R]<h[R-1]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
293 ms |
1208 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 |
405 ms |
1860 KB |
Output is correct |
2 |
Correct |
540 ms |
1868 KB |
Output is correct |
3 |
Correct |
559 ms |
1864 KB |
Output is correct |
4 |
Correct |
552 ms |
1860 KB |
Output is correct |
5 |
Correct |
508 ms |
1868 KB |
Output is correct |
6 |
Correct |
528 ms |
1868 KB |
Output is correct |
7 |
Correct |
514 ms |
1864 KB |
Output is correct |
8 |
Correct |
546 ms |
1868 KB |
Output is correct |
9 |
Correct |
534 ms |
1868 KB |
Output is correct |
10 |
Correct |
519 ms |
1864 KB |
Output is correct |
11 |
Correct |
561 ms |
1860 KB |
Output is correct |
12 |
Correct |
559 ms |
1864 KB |
Output is correct |
13 |
Correct |
551 ms |
1868 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 |
10 ms |
2032 KB |
Output is correct |
18 |
Correct |
9 ms |
1868 KB |
Output is correct |
19 |
Correct |
9 ms |
1852 KB |
Output is correct |
20 |
Correct |
9 ms |
1932 KB |
Output is correct |
21 |
Correct |
15 ms |
1860 KB |
Output is correct |
22 |
Correct |
14 ms |
1864 KB |
Output is correct |
23 |
Correct |
10 ms |
1856 KB |
Output is correct |
24 |
Correct |
10 ms |
1872 KB |
Output is correct |
25 |
Correct |
10 ms |
1864 KB |
Output is correct |
26 |
Correct |
9 ms |
2116 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 |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
170 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 |
293 ms |
1208 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |