제출 #605420

#제출 시각아이디문제언어결과실행 시간메모리
605420TigryonochekkPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms340 KiB
#include <iostream>
#include "biscuits.h"
#include <vector>
#include <map>
#define ll long long
#define pll pair<ll, ll>
using namespace std;
const int K = 62;

long long count_tastiness(long long x, vector<long long> a) {
	map<ll, ll> dp0, dp1;
	int k = a.size();
	dp0[a[0]] = 1;
	if (a[0] > x) {
		dp0[a[0] - x] = 1;
	}
	for (int i = 0; i < k - 1; i++) {
		for (auto jt = dp0.begin(); jt != dp0.end(); jt++) {
			pll wtf = *jt;
			ll j = wtf.second;
			dp1[j / 2 + a[i + 1]] += dp0[j];
			if (j > x) {
				dp1[(j - x) / 2 + a[i + 1]] += dp0[j];
			}
		}
	}
	ll ans = 0;
	for (auto it = dp1.begin(); it != dp1.end(); it++) {
		ans += (*it).second;
	}
	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...