Submission #1054582

#TimeUsernameProblemLanguageResultExecution timeMemory
1054582Gromp15Packing Biscuits (IOI20_biscuits)C++17
42 / 100
1008 ms24656 KiB
#include <bits/stdc++.h>
#include "biscuits.h"
#define ll long long
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
using namespace std;

long long count_tastiness(long long x, std::vector<long long> a) {
	map<ll, ll> dp;
	dp[0] = 1;
	for (int i = 0; i < sz(a) + 100; i++) {
		map<ll, ll> dp2;
		ll cur = i < sz(a) ? a[i] : 0;
		for (auto [j, val] : dp) {
			if (j + cur >= x) dp2[(j + cur - x) >> 1] += val;
			dp2[(j + cur) >> 1] += val;
		}
		swap(dp, dp2);
	}
	ll ans = 0;
	for (auto [z, y] : dp) ans += y;
	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...