#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int id;
int mx, mx2;
vector<int> a;
void init(int N, std::vector<int> H) {
id = N - 1;
a = H;
for (int i = 0; i < N - 1; ++i) {
if (H[i] > H[i + 1]) id = i;
}
for (int i = 0; i < id; ++i) {
mx = min(mx, H[i]);
}
for (int i = id + 1; i < N; ++i) {
mx2 = min(mx, H[i]);
}
}
int max_towers(int L, int R, int D) {
if (L < id && R > id) {
int mn1 = a[id], mn2 = a[id];
for (int i = id - 1; i >= L; --i) mn1 = min(mn1, a[i]);
for (int i = id + 1; i <= R; ++i) mn2 = min(mn2, a[i]);
return (mn1 <= a[id] - D && mn2 <= a[id] - D ? 2 : 1);
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
230 ms |
928 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: '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: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
561 ms |
1436 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
909 ms |
552 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
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: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
230 ms |
928 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |