#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> h;
int n;
vector<int> a;
void init(int N, vector<int> H) {
n = N;
h = H;
a.resize(n);
for (int i = 1; i < n - 1; i++) {
if ((h[i - 1] < h[i]) != (h[i] < h[i + 1])) {
a[i]++;
}
}
for (int i = 1; i < n; i++) {
a[i] += a[i - 1];
}
}
int max_towers(int l, int r, int D) {
int sum = a[r - 1] - a[l];
if (h[l] > h[l + 1]) {
sum--;
}
return max(1, (sum + 1) / 2);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
372 ms |
1232 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 |
0 ms |
208 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 |
208 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 |
527 ms |
1744 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 |
177 ms |
652 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 |
0 ms |
208 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 |
372 ms |
1232 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |