Submission #1078811

#TimeUsernameProblemLanguageResultExecution timeMemory
1078811LittleOrangeRadio Towers (IOI22_towers)C++17
11 / 100
4064 ms1616 KiB
#include "towers.h" #include <vector> #include<bits/stdc++.h> using namespace std; using ll = int; ll n; vector<ll> h; void init(int N, std::vector<int> H) { n = N; h = H; } int max_towers(int L, int R, int D) { vector<ll> dp(R-L+1,1); for(ll i = L+2;i<=R;i++){ ll mx = 0; for(ll j = i-1;j>=L;j--){ if (mx>=max(h[i],h[j])){ dp[i-L] = max(dp[i-L],dp[j-L]+1); } mx = max(mx,h[j]-D); } } ll ans = 0; for(ll i : dp) ans = max(i,ans); return ans; }
#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...