#include "towers.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int INF = 2'000'000'000;
vector<int> H;
int N;
vector<int> comm;
void init(int n, std::vector<int> h) {
H = h;
N = n;
comm = vector<int> (N-1, 0);
for (int i=1; i<(N-1); i++)
{
comm[i] = comm[i-1];
if ((H[i]>H[i-1]) and (H[i]>H[i+1]))
comm[i]++;
}
}
int max_towers(int L, int R, int D) {
if ((R-L)<=1)
return 1;
return 1+comm[R-1]-comm[L+1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
317 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 |
1 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 |
1 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 |
483 ms |
1880 KB |
7th lines differ - on the 1st token, expected: '4389', found: '4388' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
197 ms |
780 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 |
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 |
317 ms |
1368 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |