#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 pre[R-1] - pre[L] + 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
303 ms |
976 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 |
1 ms |
260 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 |
1 ms |
260 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 |
460 ms |
1360 KB |
Output is correct |
2 |
Correct |
553 ms |
1360 KB |
Output is correct |
3 |
Incorrect |
653 ms |
1536 KB |
18409th lines differ - on the 1st token, expected: '1', found: '0' |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
205 ms |
464 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 |
1 ms |
260 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 |
303 ms |
976 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |