이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |