#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> h;
void init(int _n, vector<int> _h) {
n = _n;
h = _h;
}
int max_towers(int l, int r, int d) {
int res = 1, last = h[l];
for (int i = l + 1; i <= r; ++i) {
if (res & 1) {
if (h[i] >= last + d) {
++res;
last = h[i];
} else {
last = min(last, h[i]);
}
} else {
if (h[i] + d <= last) {
++res;
last = h[i];
} else {
last = min(last, h[i]);
}
}
}
return (res + 1) / 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1365 ms |
976 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: '7' |
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: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4038 ms |
1440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1039 ms |
556 KB |
1st lines differ - on the 1st token, expected: '7197', found: '12' |
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: '7' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1365 ms |
976 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |