# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1035140 | NeroZein | Radio Towers (IOI22_towers) | C++17 | 0 ms | 0 KiB |
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 <bits/stdc++.h>
using namespace std;
const int LOG = 18;
int n;
int k;
vector<int> h;
vector<int> pref;
void init(int N_, vector<int> H_) {
n = N_, h = H_;
for (int i = 1; i < n; ++i) {
if (h[i] > h[i - 1] && h[i] > h[i + 1]) {
k = i;
break;
}
}
}
int max_towers(int l, int r, int d) {
if (l >= k || r <= k) {
return 1;
}
return max(a[l], a[r]) + d <= a[k];
}