#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) {
if (l == r) {
return 1;
}
int sum = a[r - 1] - a[l];
// cout << sum << "\n";
if (h[l] > h[l + 1]) {
sum--;
}
return max(1, (sum + 3) / 2);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
275 ms |
1184 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
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 |
Correct |
429 ms |
1744 KB |
Output is correct |
2 |
Correct |
524 ms |
1872 KB |
Output is correct |
3 |
Correct |
661 ms |
1872 KB |
Output is correct |
4 |
Correct |
545 ms |
1872 KB |
Output is correct |
5 |
Correct |
598 ms |
1872 KB |
Output is correct |
6 |
Correct |
687 ms |
1872 KB |
Output is correct |
7 |
Correct |
659 ms |
1872 KB |
Output is correct |
8 |
Correct |
613 ms |
1872 KB |
Output is correct |
9 |
Correct |
729 ms |
1872 KB |
Output is correct |
10 |
Correct |
611 ms |
1872 KB |
Output is correct |
11 |
Correct |
640 ms |
1872 KB |
Output is correct |
12 |
Correct |
550 ms |
1872 KB |
Output is correct |
13 |
Correct |
644 ms |
1852 KB |
Output is correct |
14 |
Correct |
1 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
1 ms |
208 KB |
Output is correct |
17 |
Correct |
9 ms |
1872 KB |
Output is correct |
18 |
Correct |
9 ms |
1848 KB |
Output is correct |
19 |
Correct |
9 ms |
1872 KB |
Output is correct |
20 |
Correct |
9 ms |
1824 KB |
Output is correct |
21 |
Correct |
17 ms |
1736 KB |
Output is correct |
22 |
Correct |
12 ms |
1848 KB |
Output is correct |
23 |
Correct |
18 ms |
1872 KB |
Output is correct |
24 |
Correct |
12 ms |
2000 KB |
Output is correct |
25 |
Correct |
9 ms |
1872 KB |
Output is correct |
26 |
Correct |
9 ms |
1856 KB |
Output is correct |
27 |
Correct |
1 ms |
208 KB |
Output is correct |
28 |
Correct |
1 ms |
208 KB |
Output is correct |
29 |
Correct |
1 ms |
208 KB |
Output is correct |
30 |
Correct |
0 ms |
208 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Correct |
1 ms |
208 KB |
Output is correct |
33 |
Correct |
1 ms |
332 KB |
Output is correct |
34 |
Correct |
1 ms |
208 KB |
Output is correct |
35 |
Correct |
1 ms |
208 KB |
Output is correct |
36 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
220 ms |
648 KB |
1st lines differ - on the 1st token, expected: '7197', found: '8004' |
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 |
275 ms |
1184 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |