#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
const int MAX = 1e5 + 10;
int n;
int maxx;
int arr[MAX];
void init(int N, std::vector<int> H) {
n = N;
maxx = 1;
for (int i = 1; i <= n; i++) {
if (H[i - 1] > H[maxx - 1]) maxx = i;
arr[i] = H[i - 1];
}
}
int max_towers(int lt, int rt, int d) {
lt++, rt++;
if (lt >= maxx) return 1;
if (rt <= maxx) return 1;
if (arr[lt] <= arr[maxx] - d && arr[rt] <= arr[maxx] - 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... |