# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1033464 | Zicrus | Packing Biscuits (IOI20_biscuits) | C++17 | 915 ms | 2097152 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 <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
typedef long long ll;
ll count_tastiness(ll x, vector<ll> a) {
for (int i = 0; i < a.size(); i++) {
ll transfer = max(0ll, (a[i]-x) / (2*x));
if (transfer > 0) {
if (i+1 >= a.size()) a.push_back(x*transfer);
else a[i+1] += x*transfer;
a[i] -= 2*x*transfer;
}
}
ll n = a.size();
ll m = 6*x;
vector<vector<ll>> dp(n, vector<ll>(m));
for (int i = 0; i < m; i++) {
dp.back()[i] = i/x + 1;
}
for (int i = n-2; i >= 0; i--) {
for (int j = 0; j < m; j++) {
dp[i][j] = dp[i+1][a[i+1] + j/2];
if (j >= x) {
dp[i][j] += dp[i+1][a[i+1] + (j-x)/2];
}
}
}
return dp[0][a[0]];
}
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... |