# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785255 | 2023-07-17T07:41:23 Z | ono_de206 | Radio Towers (IOI22_towers) | C++17 | 0 ms | 0 KB |
#include "towers.h" #include<bits/stdc++.h> using namespace std; #define in insert #define all(x) x.begin(),x.end() #define pb push_back #define eb emplace_back #define ff first #define ss second //#define int long long typedef long long ll; typedef vector<int> vi; typedef set<int> si; typedef multiset<int> msi; typedef pair<int, int> pii; typedef vector<pii> vpii; const int mxn = 1e5 + 10; int h[mxn], n, pos; void init(int _n, vector<int> H) { n = _n for(int i = 1; i <= n; i++) { h[i] = H[i - 1]; } for(int i = 2; i < n; i++) { if(h[i] > max(h[i - 1], h[i + 1])) pos = i; } } int max_towers(int L, int R, int D) { L++; R++; return (L < pos && R > pos && max(h[L], h[R]) <= h[pos] - D); }