// incorrect/solution-d-equals-one.cpp
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> H;
vector<int> pre_sum;
void init(int _N, std::vector<int> _H) {
N = _N;
H = _H;
pre_sum.resize(N);
for (int i = 1; i < N - 1; ++i) {
pre_sum[i] = pre_sum[i - 1];
if (H[i] < min(H[i - 1], H[i + 1])) {
pre_sum[i] += 1;
}
}
}
int max_towers(int L, int R, int D) {
if (L == R) {
return 1;
}
int answer = pre_sum[R - 1] - pre_sum[L];
if (H[L] < H[L + 1]) {
++answer;
}
if (H[R] < H[R - 1]) {
++answer;
}
return answer;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
413 ms |
1224 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 |
1 ms |
256 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 |
256 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 |
Correct |
741 ms |
1828 KB |
Output is correct |
2 |
Correct |
988 ms |
1836 KB |
Output is correct |
3 |
Correct |
763 ms |
1832 KB |
Output is correct |
4 |
Correct |
869 ms |
1824 KB |
Output is correct |
5 |
Correct |
1081 ms |
1852 KB |
Output is correct |
6 |
Correct |
938 ms |
1836 KB |
Output is correct |
7 |
Correct |
1091 ms |
1848 KB |
Output is correct |
8 |
Correct |
1079 ms |
1820 KB |
Output is correct |
9 |
Correct |
988 ms |
1828 KB |
Output is correct |
10 |
Correct |
1391 ms |
1836 KB |
Output is correct |
11 |
Correct |
976 ms |
1832 KB |
Output is correct |
12 |
Correct |
1010 ms |
1816 KB |
Output is correct |
13 |
Correct |
1254 ms |
1832 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 |
15 ms |
1812 KB |
Output is correct |
18 |
Correct |
23 ms |
1840 KB |
Output is correct |
19 |
Correct |
22 ms |
1812 KB |
Output is correct |
20 |
Correct |
14 ms |
1824 KB |
Output is correct |
21 |
Correct |
17 ms |
1808 KB |
Output is correct |
22 |
Correct |
22 ms |
1836 KB |
Output is correct |
23 |
Correct |
15 ms |
1828 KB |
Output is correct |
24 |
Correct |
16 ms |
1856 KB |
Output is correct |
25 |
Correct |
13 ms |
1808 KB |
Output is correct |
26 |
Correct |
23 ms |
1832 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 |
256 KB |
Output is correct |
30 |
Correct |
1 ms |
208 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Correct |
1 ms |
244 KB |
Output is correct |
33 |
Correct |
1 ms |
208 KB |
Output is correct |
34 |
Correct |
1 ms |
208 KB |
Output is correct |
35 |
Correct |
1 ms |
256 KB |
Output is correct |
36 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
260 ms |
644 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 |
1 ms |
256 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 |
413 ms |
1224 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |