Submission #605393

#TimeUsernameProblemLanguageResultExecution timeMemory
605393HamletPetrosyanPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1104 ms281804 KiB
#include "biscuits.h"
#include <map>
using namespace std;

#define ll long long
#define add push_back
#define len(a) ((int)(a).size())

map<ll, int> dp[70];

long long count_tastiness(long long x, vector<long long> a) {
	dp[0][0] = 1;
	for(int i = 0; i <= len(a) + 10; i++){
		for(auto [key, value] : dp[i]){
			dp[i + 1][((key + (i >= len(a) ? 0 : a[i])) / 2)] += value;
			if((i >= len(a) ? 0 : a[i]) + key >= x) dp[i + 1][(key + (i >= len(a) ? 0 : a[i]) - x) / 2] += value;
		}
	}
	ll ret = 0;
	for(auto [key, value] : dp[len(a) + 7]){
		ret += value;
	}
	return ret;
}


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