Submission #1047473

#TimeUsernameProblemLanguageResultExecution timeMemory
1047473jer033비스킷 담기 (IOI20_biscuits)C++17
21 / 100
1098 ms63436 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

vector<ll> aa;
map<pair<int, ll>, ll> b;
 
long long count_hastiness(ll x, int ind, ll bonus)
{
    if (b[{ind, bonus}]>0)
        return b[{ind, bonus}];
    if (ind == 60)
        return 1ll;
    ll bac = aa[ind]+bonus;
    ll ans = 0;
    if (bac >= x)
        ans += count_hastiness(x, ind+1, (bac-x)/2ll);
    ans += count_hastiness(x, ind+1, bac/2ll);
    b[{ind, bonus}] = ans;
    return ans;
}
 
long long count_tastiness(long long x, std::vector<long long> a) {
    b.clear();
	int k = a.size();
    for (int i=1; i<=(60-k); i++)
        a.push_back(0ll);
    aa = a;
    /*vector<ll> aa(60);
    for (int i=0; i<60; i++)
        aa[i] = a[59-i];*/
    return count_hastiness(x, 0, 0ll);
}
#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...