Submission #605431

#TimeUsernameProblemLanguageResultExecution timeMemory
605431gagik_2007Packing Biscuits (IOI20_biscuits)C++17
42 / 100
1100 ms16644 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef ll itn;

#define ff first
#define ss second

ll n;
ll lg;
ll ans=0;
map<ll, ll>dp[2];

ll count_tastiness(ll x, vector<ll> a) {
    for(int i=0;i<66;i++){
        a.push_back(0);
    }
    ans=0;
	n = a.size();
	dp[0][0]=1;
	for(int i=0;i<n;i++){
        for(auto c:dp[0]){
            if(c.ff+a[i]-x>=0){
                dp[1][(c.ff+a[i]-x)/2]+=c.ss;
            }
            dp[1][(c.ff+a[i])/2]+=c.ss;
        }
        dp[0]=dp[1];
        dp[1].clear();
	}
	ans=dp[0][0];
	dp[0].clear();
	return ans;
}

/*
3
3 2
2 1 2
3 2
2 1 2
3 1
2 1 1
*/
#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...