Submission #1062879

#TimeUsernameProblemLanguageResultExecution timeMemory
1062879MarwenElarbiRadio Towers (IOI22_towers)C++17
14 / 100
683 ms2252 KiB
#include <bits/stdc++.h> using namespace std; #include "towers.h" #define pb push_back #define ll long long #define fi first #define se second const int nax=1e5+5; int n; vector<int> tab; int pre[nax]; void init(int N, std::vector<int> H) { n=N; for (int i = 0; i < N; ++i) { tab.pb(H[i]); } for (int i = 1; i < n-1; ++i) { if(tab[i]<=tab[i-1]&&tab[i]<=tab[i+1]) pre[i]=1; pre[i]+=pre[i-1]; } pre[n-1]+=pre[n-2]; } int max_towers(int L, int R, int D){ if(R-L+1<=2) return 1; return pre[R-1]-pre[L]+(tab[L]<=tab[L+1])+(tab[R]<=tab[R-1]); }
#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...