Submission #1061805

#TimeUsernameProblemLanguageResultExecution timeMemory
1061805MarwenElarbiRadio Towers (IOI22_towers)C++17
0 / 100
4043 ms1748 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 int n; vector<int> tab; void init(int N, std::vector<int> H) { n=N; for (int i = 0; i < N; ++i) { tab.pb(H[i]); } } int max_towers(int L, int R, int D){ int dp[n]; for (int i = L; i <= R; ++i) { dp[i]=1; int mx=-1; for (int j = i-1; j >= L; --j) { if(tab[j]<=mx-D&&tab[i]<=mx-D){ dp[i]=max(dp[i],dp[j]+1); } mx=max(mx,tab[j]); } } return dp[R]; }
#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...