# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1066014 | Ahmed57 | Packing Biscuits (IOI20_biscuits) | C++17 | 1100 ms | 63312 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
#define int long long
map<int,int> dp[61];
vector<int> A;
int lim , X;
int solve(int i,int ans){
if(i==lim){
return 1;
}
if(dp[i].find(ans)!=dp[i].end())return dp[i][ans];
int nans = ans+A[i];
int c1 = solve(i+1,nans/2);
if(nans>=X){
c1 += solve(i+1,(nans-X)/2);
}
return dp[i][ans] = c1;
}
long long count_tastiness(long long x,vector<long long> a){
A.clear();
for(int i = 0;i<=60;i++)dp[i].clear();
for(int i = 0;i<a.size();i++)A.push_back(a[i]);
int k = A.size();
int ans = 0;
for(int i = 0;i<A.size();i++){
ans/=2;
ans+=A[i];
}
while(ans>1){
ans/=2;
A.push_back(0);
}
k = A.size();
lim = k;
X = x;
return solve(0,0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |