제출 #416522

#제출 시각아이디문제언어결과실행 시간메모리
416522SuhaibSawalha1비스킷 담기 (IOI20_biscuits)C++17
21 / 100
1087 ms63300 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

vector<long long> a;
long long x;
map<long long, long long> dp[60];

long long calc (int i = 0, long long hv = 0) {
	if (i == 60) {
		return 1;
	}
	hv = (hv / 2) + a[i];
	if (dp[i].count(hv)) {
		return dp[i][hv];
	}
	long long ret = calc(i + 1, hv);
	if (hv >= x) {
		ret += calc(i + 1, hv - x);
	}
	return dp[i][hv] = ret;
}

long long count_tastiness(long long x, vector<long long> t) {
	::a = t;
	::x = x;
	for (int i = 0; i < 60; ++i) {
		dp[i].clear();
	}
	while (a.size() < 60) {
		a.push_back(0);
	}
	return calc();
}
#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...