Submission #321523

#TimeUsernameProblemLanguageResultExecution timeMemory
321523grtPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1090 ms492 KiB
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using ll = long long; using pi = pair<int,int>; #define ST first #define ND second #define PB push_back map<pair<int, ll>, ll>dp; vector<ll>A; ll X; ll rec(int a, ll add) { if(dp.find({a,add}) != dp.end()) return dp[{a,add}]; ll cur = A[a] + add; if(a >= 65) return 1; ll ans = 0; if(cur >= X) { cur -= X; if(dp.find({a + 1, cur/2}) != dp.end()) ans+=dp[{a+1,cur/2}]; else ans += rec(a + 1, cur / 2); cur += X; } if(dp.find({a+1,cur/2}) != dp.end()) ans += dp[{a+1, cur/2}]; else ans += rec(a + 1, cur/2); return ans; } ll count_tastiness(ll x, vector<ll>a) { A.resize(65); for(int i = 0; i < (int)a.size(); ++i) A[i] = a[i]; X = x; dp.clear(); return rec(0, 0); } //int main() { // cout << count_tastiness(2,{2,1,2}); //}
#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...