Submission #828831

#TimeUsernameProblemLanguageResultExecution timeMemory
828831Abrar_Al_SamitPacking Biscuits (IOI20_biscuits)C++17
42 / 100
48 ms40208 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; int k; vector<long long>a; long long dp[125][20001]; long long x; long long solve(int i, int j) { if(i>=k) return 1; long long &ret = dp[i][j]; if(ret!=-1) return ret; ret = 0; int cr = a[i] + j; if(cr < x) ret = solve(i+1, cr/2); else { ret = solve(i+1, cr/2) + solve(i+1, (cr-x)/2); } return ret; } long long count_tastiness(long long X, vector<long long> A) { A.resize(122); k = A.size(); a = A; x = X; for(int i=0; i<k-1; ++i) { if(a[i]<=x) continue; long long take = max(0LL, a[i] - x); a[i] -= take - (take & 1); a[i+1] += take / 2; } memset(dp, -1, sizeof dp); return solve(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...