# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
635781 | 2022-08-26T23:31:00 Z | activedeltorre | Radio Towers (IOI22_towers) | C++17 | 0 ms | 0 KB |
#include <iostream> #include <vector> using namespace std; int n,cent; int h[200005]; init (int N, vector<int>vec) { int n=N; int i; for(i=1;i<=n;i++) { h[i]=vec[i-1]; if(h[i]==n) { cent=i; } } } max_towers(int l,int r,int d) { if(l<=cent && r>=cent && max(h[l],h[r])+d<=n) { return 2; } else { return 1; } }