Submission #1047437

#TimeUsernameProblemLanguageResultExecution timeMemory
1047437jer033Packing Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms348 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

long long count_hastiness(ll x, vector<ll> a, ll bonus)
{
    //basically, the biscuits are now in order. Woohoo!
    int b = a.size();
    if (b==0)
        return 1;
    a[b-1] += bonus;
    ll bac = a[b-1];
    a.pop_back();
    ll ans = 0;
    if (bac >= x)
    {
        ans += 1;
        ans += count_hastiness(x, a, (bac-x)/2ll);
    }
    ans += count_hastiness(x, a, bac/2ll);
    return ans;
}

long long count_tastiness(long long x, std::vector<long long> a) {
	int k = a.size();
    vector<ll> aa(k);
    for (int i=0; i<k; i++)
        aa[i] = a[k-1-i];
    return count_hastiness(x, aa, 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...