#include <vector>
#include <iostream>
int n;
std::vector<int> h;
void init(int N, std::vector<int> H) {
n = N;
h = H;
}
int max_towers(int L, int R, int D) {
if (L == R) return 1;
R += 1;
std::vector<int> included { h[L] };
int greatest = h[L];
for (int i = L + 1; i < R; i++) {
if (h[i] > greatest) {
greatest = h[i];
} else if (greatest - included.back() < D) {
if (h[i] < included.back()) {
included.pop_back();
included.push_back(h[i]);
greatest = h[i];
}
} else {
included.push_back(h[i]);
greatest = h[i];
}
}
return included.size();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1000 ms |
976 KB |
5th lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '15' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '15' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4054 ms |
1360 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3841 ms |
556 KB |
1st lines differ - on the 1st token, expected: '7197', found: '7498' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '15' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1000 ms |
976 KB |
5th lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |