제출 #1170444

#제출 시각아이디문제언어결과실행 시간메모리
1170444samiaBouquet (EGOI24_bouquet)C++20
0 / 100
3094 ms1976 KiB
#include <bits/stdc++.h> using namespace std; vector<int>v; int f[200005]; int dp(int n){ if(f[n]==-1){ int x=0; for(int so=0;so<n-v[n];so++){ if(f[so]==-1){dp(so);} x=max(x,f[so]); } f[n]=x+1; } // cout<<f[n]<<" "<<n<<endl; return f[n]; } int main() { int n; cin>>n; int x,y; int ans=n; while(n--){ cin>>x>>y; v.push_back(x); } for(int so=0;so<=ans;so++){ f[so]=-1; } f[0]=1; int an=0; for(int so=0;so<ans;so++){ if(f[so]==-1){dp(so);} an=max(an,f[so]); } cout<<an<<endl; }
#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...