제출 #1014878

#제출 시각아이디문제언어결과실행 시간메모리
1014878Unforgettablepl비스킷 담기 (IOI20_biscuits)C++17
0 / 100
499 ms33236 KiB
#include <bits/stdc++.h>
using namespace std;

const int LIMIT = 18;

long long count_tastiness(long long x, std::vector<long long> a) {
	map<pair<int,int>,long long> memo;
	function<long long(int,int)> calc = [&](int i,int j){
		j=max(j,0);
		if(memo.count({i,j}))return memo[{i,j}];
		if(i==-1)return j==0 ? 1ll : 0ll;
		long long ac = calc(i-1,2*(j-a[i]));
		if(ac>0)return memo[{i,j}] = calc(i-1,2*(j-a[i]+x))+ac;
		else return memo[{i,j}]=0ll;
	};
	a.resize(LIMIT+1);
	return calc(LIMIT,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...