# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
805405 | WLZ | Packing Biscuits (IOI20_biscuits) | C++17 | 1079 ms | 120004 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "../../templates/debug.h"
#else
#define debug(...) 0
#endif
const int X = 130;
long long count_tastiness(long long x, std::vector<long long> a) {
for (int i = 0; i < (int) a.size(); i++) {
if (a[i] > x) {
if (i == (int) a.size() - 1) a.push_back(0);
a[i + 1] += (a[i] - x) / 2;
a[i] -= (a[i] - x) / 2 * 2;
}
}
while ((int) a.size() < X) a.push_back(0);
//int k = (int) a.size();
long long ans = 0;
vector< vector<long long> > dp(X, vector<long long>(2 * x + 5));
dp[0][0] = 1;
for (int i = 0; i < X; i++) {
for (int j = 0; j < 2 * x + 5; j++) {
ans += dp[i][j];
long long extra = j;
for (int t = i + 1; t < X; t++) {
extra = (extra / 2) - (extra < 0);
extra += a[t - 1];
if (extra >= x) dp[t][extra - x] += dp[i][j];
}
}
}
debug(dp);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |