#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> h;
int f[100009], p[100009];
bool used[100009];
void init(int N, std::vector<int> H) {
h = H;
f[0] = 1000000009;
f[H.size()] = 0;
for (int i = 1; i < N; i++)
{
f[i] = H[i - 1];
}
p[0] = 0;
for (int i = 1; i <= N; i++)
{
p[i] = p[i - 1];
if (f[i - 1] > f[i] && f[i + 1] > f[i])
{
p[i]++;
used[i] = true;
}
}
}
int max_towers(int L, int R, int D) {
int ans = p[R] - p[L - 1];
if (!used[L] && f[L - 1] > f[L])
{
ans++;
}
if (L != R && !used[R] && f[R + 1] > f[R])
{
ans++;
}
return max(ans, 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
418 ms |
1440 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
1 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 |
653 ms |
2208 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 |
283 ms |
780 KB |
1st lines differ - on the 1st token, expected: '7197', found: '8003' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
418 ms |
1440 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |