# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
762289 | raysh07 | 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;
int k;
vector <int> a;
void init(int N, vector<int> H) {
k = -1;
for (int i = 0; i < N; i++){
bool good = true;
if (i != 0) good &= H[i] > H[i - 1];
if (i != N - 1) good &= H[i] > H[i + 1];
if (good) k = i;
}
a = H;
assert(k != -1);
}
int max_towers(int L, int R, int D) {
if (L < k && R > k) {
if (a[L] <= a[k] - D && a[r] <= a[k] - D) return 2;
else return 1;
}
else return 1;
}