#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#include <vector>
int n, largest, pos;
vector<int> heights;
void init(int N, std::vector<int> H) {
n = N;
for (int &i : H) heights.push_back(i);
largest = *max_element(H.begin(), H.end());
pos = find(H.begin(), H.end(), largest) - H.begin();
}
int max_towers(int L, int R, int D) {
if (L >= pos) return 1;
if (R <= pos) return 1;
if (heights[L] <= largest - D && heights[R] <= largest - D) return 2;
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... |