제출 #1088177

#제출 시각아이디문제언어결과실행 시간메모리
1088177AlmontherBouquet (EGOI24_bouquet)C++98
0 / 100
3070 ms9940 KiB
#include <bits/stdc++.h> #define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define co cout<< //#pragma GCC optimize("O3,Ofast,unroll-loops") //#pragma GCC target("avx2,sse3,sse4,avx") using namespace std; //stuff void solve(){ ll n; cin>>n; ll l[n+5],r[n+5],dp[n+5]={}; vector<pair<ll,ll>>v; for(ll i=1;i<=n;i++){ cin>>l[i]>>r[i]; l[i]=min(i-1,l[i]); r[i]=min(n-i,r[i]); v.push_back({l[i]+r[i],i}); } dp[0]=0; ll mx=0; for(int i=1;i<=n;i++){ ll mx1=0; for(int j=i-l[i]-1;j>=1;j--) if(j+r[j]<i) mx1=max(mx,dp[j]); dp[i]=mx1+1; mx=max(mx,dp[i]); } co mx; } int main() { suiii int _=1; // cin>>_; while(_--) solve(); return 0; }
#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...