Submission #1054554

#TimeUsernameProblemLanguageResultExecution timeMemory
1054554Gromp15비스킷 담기 (IOI20_biscuits)C++17
0 / 100
71 ms856 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;

const int N = 2e4;

long long count_tastiness(long long x, std::vector<long long> a) {
	vector<ll> dp(N+1);
	dp[0] = 1;
	for (int i = 0; i < sz(a); i++) {
		vector<ll> dp2(N+1);
		for (int j = 0; j <= N; j++) if (dp[j]) {
			if (j + a[i] >= x) dp2[min<ll>(N, (j + a[i] - x) >> 1)] += dp[j];
			dp2[min<ll>(N, (j + a[i]) >> 1)] += dp[j];
		}
		swap(dp, dp2);
	}
	return accumulate(all(dp), 0LL);
}

#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...