#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];
// cout << sum << "\n";
if (h[l] > h[l + 1]) {
sum--;
}
return max(1, (sum + 2) / 2);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
274 ms |
1232 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
416 ms |
1816 KB |
1st lines differ - on the 1st token, expected: '11903', found: '11902' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
135 ms |
644 KB |
1st lines differ - on the 1st token, expected: '7197', found: '8003' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
274 ms |
1232 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |