# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
866502 | 2023-10-26T09:18:57 Z | vjudge1 | Radio Towers (IOI22_towers) | C++17 | 0 ms | 0 KB |
#include "towers.h" #include<bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 3; int p = 0; int a[MAXN]; void init(int N, vector<int> H) { int mx = 0; for (int i = 0; i < N; i++){ if (H[i] > mx) mx = H[i], p = i; a[i] = H[i]; } return; } int max_towers(int L, int R, int D) { if (p != 0 && p != N-1 && a[p-1] <= a[p]-D && a[p+1] <= a[p]-D){ return 2; } return 1; }