This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "towers.h"
#include <vector>
int k;
std::vector<int> arr;
void init(int N, std::vector<int> H) {
for (int i = 1; i < N; i++) {
if (H[i] < H[i - 1]) {
k = i - 1;
break;
}
}
for (int i = 0; i < N; i++) arr.push_back(H[i]);
}
int max_towers(int L, int R, int D) {
if (L >= k || R <= k) return 1;
else {
if (arr[k] - arr[L] >= D && arr[k] - arr[R] >= D) return 2;
else return 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... |