Submission #620647

#TimeUsernameProblemLanguageResultExecution timeMemory
620647wiwihoPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1093 ms312 KiB
#include "biscuits.h"

#include <bits/stdc++.h>

#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define ef emplace_front
#define pob pop_back()
#define pof pop_front()
#define mp make_pair
#define F first
#define S second
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define printv(a, b) { \
    for(auto pv : a) b << pv << " "; \
    b << "\n"; \
}

using namespace std;

typedef long long ll;
typedef long double ld;

using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}

long long count_tastiness(long long x, vector<long long> a){
    
    a.resize(60);
    int K = 60;
    a.eb();
    ll ans = 0;

    vector<int> owo(K);
    function<void(int)> dfs = [&](int now){
        if(now == K){
            ans++;
            return;
        }
        
        ll tmp = a[now] / 2;
        a[now + 1] += tmp;
        dfs(now + 1);
        a[now + 1] -= tmp;

        if(a[now] < x) return;
        tmp = (a[now] - x) / 2;
        a[now + 1] += tmp;
        owo[now] = 1;
        dfs(now + 1);
        owo[now] = 0;
        a[now + 1] -= tmp;
    };
    dfs(0);

	return ans;
}

#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...