#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
//subtask 4
const int nax = 100005;
int n;
int pre[nax];
void init(int N, vector<int> H) {
n = N;
for(int i=1; i<n-1; ++i) {
if(H[i]>H[i-1] && H[i]>H[i+1]) pre[i] = 1;
pre[i] += pre[i-1];
}
}
int max_towers(int L, int R, int D) {
if(R==0) return 1;
return max(1, pre[R-1] - pre[L] + 1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
235 ms |
932 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
462 ms |
1448 KB |
Output is correct |
2 |
Correct |
629 ms |
1480 KB |
Output is correct |
3 |
Correct |
615 ms |
1352 KB |
Output is correct |
4 |
Correct |
639 ms |
1476 KB |
Output is correct |
5 |
Correct |
583 ms |
1440 KB |
Output is correct |
6 |
Correct |
520 ms |
1468 KB |
Output is correct |
7 |
Correct |
617 ms |
1360 KB |
Output is correct |
8 |
Correct |
647 ms |
1472 KB |
Output is correct |
9 |
Correct |
611 ms |
1448 KB |
Output is correct |
10 |
Correct |
603 ms |
1440 KB |
Output is correct |
11 |
Correct |
571 ms |
1468 KB |
Output is correct |
12 |
Correct |
619 ms |
1448 KB |
Output is correct |
13 |
Correct |
544 ms |
1476 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
208 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
10 ms |
1464 KB |
Output is correct |
18 |
Correct |
9 ms |
1360 KB |
Output is correct |
19 |
Correct |
9 ms |
1444 KB |
Output is correct |
20 |
Correct |
17 ms |
1476 KB |
Output is correct |
21 |
Correct |
17 ms |
1452 KB |
Output is correct |
22 |
Correct |
15 ms |
1444 KB |
Output is correct |
23 |
Correct |
16 ms |
1352 KB |
Output is correct |
24 |
Correct |
15 ms |
1360 KB |
Output is correct |
25 |
Correct |
12 ms |
1360 KB |
Output is correct |
26 |
Correct |
15 ms |
1356 KB |
Output is correct |
27 |
Correct |
0 ms |
208 KB |
Output is correct |
28 |
Correct |
1 ms |
208 KB |
Output is correct |
29 |
Correct |
0 ms |
208 KB |
Output is correct |
30 |
Correct |
1 ms |
208 KB |
Output is correct |
31 |
Correct |
0 ms |
208 KB |
Output is correct |
32 |
Correct |
1 ms |
208 KB |
Output is correct |
33 |
Correct |
1 ms |
208 KB |
Output is correct |
34 |
Correct |
1 ms |
208 KB |
Output is correct |
35 |
Correct |
1 ms |
208 KB |
Output is correct |
36 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
159 ms |
464 KB |
1st lines differ - on the 1st token, expected: '7197', found: '8004' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
235 ms |
932 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |