#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;
int ans = comm[R-1]-comm[L+1];
if (H[L] < H[L+1])
ans++;
if (H[R] < H[R-1])
ans++;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
323 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 |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '15' |
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: '15' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
489 ms |
1880 KB |
1st lines differ - on the 1st token, expected: '11903', found: '11902' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
174 ms |
600 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: '15' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
323 ms |
1368 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |