#include<bits/stdc++.h>
#include "towers.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,f[100009],jm[100009],L,R,D,F[100009];
void init(int NN, std::vector<int> HH) {
a=NN;
for(i=1; i<=a; i++) f[i]=HH[i-1];
f[0]=1000000009;f[a+1]=f[0];
for(i=1; i<=a; i++){
jm[i]=jm[i-1];
if(f[i]<f[i-1]&&f[i]<f[i+1]){
jm[i]++;F[i]=1;
}
}
}
int max_towers(int LL, int RR, int DD) {
L=LL+1;R=RR+1;D=DD;
zx=jm[R]-jm[L-1];
if(F[L]==0&&f[L]<f[L+1]) zx++;
if(L!=R&&F[R]==0&&f[R]<f[R-1]) zx++;
zx=max(zx,1);
return zx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
357 ms |
1184 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 |
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 |
0 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 |
713 ms |
2208 KB |
Output is correct |
2 |
Correct |
897 ms |
2204 KB |
Output is correct |
3 |
Correct |
919 ms |
2212 KB |
Output is correct |
4 |
Correct |
937 ms |
2216 KB |
Output is correct |
5 |
Correct |
785 ms |
2236 KB |
Output is correct |
6 |
Correct |
757 ms |
2220 KB |
Output is correct |
7 |
Correct |
877 ms |
2220 KB |
Output is correct |
8 |
Correct |
708 ms |
1872 KB |
Output is correct |
9 |
Correct |
797 ms |
1736 KB |
Output is correct |
10 |
Correct |
677 ms |
1864 KB |
Output is correct |
11 |
Correct |
784 ms |
1872 KB |
Output is correct |
12 |
Correct |
795 ms |
1736 KB |
Output is correct |
13 |
Correct |
733 ms |
1844 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 |
12 ms |
2216 KB |
Output is correct |
18 |
Correct |
14 ms |
2216 KB |
Output is correct |
19 |
Correct |
13 ms |
2124 KB |
Output is correct |
20 |
Correct |
11 ms |
1828 KB |
Output is correct |
21 |
Correct |
12 ms |
1864 KB |
Output is correct |
22 |
Correct |
12 ms |
2216 KB |
Output is correct |
23 |
Correct |
11 ms |
2196 KB |
Output is correct |
24 |
Correct |
12 ms |
2212 KB |
Output is correct |
25 |
Correct |
11 ms |
1828 KB |
Output is correct |
26 |
Correct |
11 ms |
1828 KB |
Output is correct |
27 |
Correct |
1 ms |
384 KB |
Output is correct |
28 |
Correct |
0 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 |
279 ms |
680 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 |
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 |
357 ms |
1184 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |