Submission #1119719

#TimeUsernameProblemLanguageResultExecution timeMemory
1119719ezzzayBouquet (EGOI24_bouquet)C++14
0 / 100
3082 ms5028 KiB
#include<bits/stdc++.h> using namespace std; #define itn long long #define int long long #define ff first #define ss second #define pb push_back const int N=3e5+5; int l[N],r[N]; int dp[N]; signed main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>l[i]>>r[i]; l[i]=max(i-l[i],1LL); r[i]=min(i+r[i],n); } int ans=0; for(int i=1;i<=n;i++){ for(int j=0;j<l[i];j++){ dp[max(i,r[i]-1)]=max(dp[max(i,r[i]-1)],dp[j]+1); ans=max(ans,dp[max(i,r[i]-1)]); } } cout<<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...