Submission #821683

#TimeUsernameProblemLanguageResultExecution timeMemory
821683oscar1fPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1088 ms3044 KiB
#include<bits/stdc++.h> #include "biscuits.h" using namespace std; using ll=long long; const ll MAX_VAL=61; ll nbTas; ll val[MAX_VAL]; unordered_map<ll,ll> memo[MAX_VAL]; ll dyna(int pos,int rest) { if (pos==MAX_VAL) { return 1; } if (memo[pos][rest]!=0) { return memo[pos][rest]; } int ans=0; rest+=val[pos]; ans+=dyna(pos+1,rest/2); if (rest>=nbTas) { ans+=dyna(pos+1,(rest-nbTas)/2); } memo[pos][rest]=ans; return ans; } ll count_tastiness(ll x,vector<long long> a) { nbTas=x; for (ll i=0;i<MAX_VAL;i++) { memo[i].clear(); if (i>=(ll)a.size()) { val[i]=0; } else { val[i]=a[i]; } } return dyna(0,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...