Submission #1120110

#TimeUsernameProblemLanguageResultExecution timeMemory
1120110ezzzayBouquet (EGOI24_bouquet)C++14
24 / 100
83 ms10664 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]; int p[N]; signed main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>l[i]>>r[i]; } int ans=0; for(int i=1;i<=n;i++){ dp[i]=1; dp[i]=max(dp[i],p[max(0ll,i-l[i]-1)]+1); ans=max(ans,dp[i]); p[i]=max(dp[i],p[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...