Submission #782012

#TimeUsernameProblemLanguageResultExecution timeMemory
782012FEDIKUSRadio Towers (IOI22_towers)C++17
14 / 100
844 ms1864 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; using mim = pair<pair<int,int>,int>; const int maxn=1e5+10; const int logg=18; int n; int h[maxn]; int pref[maxn]; void init(int _n, vector<int> _h) { n=_n; for(int i=0;i<n;i++) h[i]=_h[i]; for(int i=1;i<n-1;i++){ pref[i]=pref[i-1]; if(h[i]<h[i+1] && h[i]<h[i-1]) pref[i]++; } } int max_towers(int l, int r, int d) { int ret=int(l==r); if(l+1<=r-1) ret+=pref[r-1]-pref[l]; if(r-l>0 && h[l]<h[l+1]) ret++; if(r-l>0 && h[r]<h[r-1]) ret++; return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...