Submission #605452

#TimeUsernameProblemLanguageResultExecution timeMemory
605452HamletPetrosyanPacking Biscuits (IOI20_biscuits)C++17
12 / 100
10 ms1104 KiB
#include "biscuits.h"
#include <iostream>
#include <map>
using namespace std;

#define ll long long
#define add push_back
#define len(a) ((int)(a).size())
#define fr first
#define sc second

long long count_tastiness(long long x, vector<long long> a) {
	vector<long long> v;
	v.resize(70);
	for(int i = 0; i < 70; i++){
		if(i < len(a)){
			v[i] += a[i];
		}
		v[i + 1] += (v[i] % x) / 2;
		v[i] /= x;
	}

	map<ll, ll> dp[80];

	dp[0][0] = 1;
	for(int i = 0; i < len(v); i++){
		for(auto h : dp[i]){
			dp[i + 1][((h.fr + v[i]) / 2)] += h.sc;
			if(v[i] + h.fr >= 1) dp[i + 1][(h.fr + v[i] - 1) / 2] += h.sc;
		}
	}
	return dp[len(v)][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...