이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 lst = l - 1;
int good_towers = 0;
for (int i = l + 1; i < r; ++i) {
if (h[i] < h[i - 1] || h[i] < h[i + 1]) {
continue;
}
int mn = h[lst + 1];
for (int j = lst + 1; j < i; ++j) {
mn = min(mn, h[j]);
}
if (h[i] - mn >= d) {
lst = i;
good_towers++;
}
}
return good_towers + 1;
}
# | 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... |