Submission #473215

#TimeUsernameProblemLanguageResultExecution timeMemory
473215Ahmed_SolymanSan (COCI17_san)C++14
24 / 120
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,k; ll dp[45][45]; vector<ll>a(45),b(45); ll solve(ll i,ll prev,ll sum){ if(i==n)return 0; ll &ret=dp[i][prev]; if(~ret)return ret; ll Take=0; ll notTake=solve(i+1,prev,sum); if(a[i]>=a[prev]){ Take=solve(i+1,i,sum+b[i])+(sum+b[i]>=k); } return ret=Take+notTake; } int main() { memset(dp,-1,sizeof(dp)); cin>>n>>k; for(ll i=0;i<n;i++)cin>>a[i]>>b[i]; cout<<solve(0,44,0)<<endl; 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...