# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1033447 | Zicrus | Packing Biscuits (IOI20_biscuits) | C++17 | 2 ms | 600 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]-1) / 2);
if (transfer > 0) {
if (i+1 >= a.size()) a.push_back(transfer);
else a[i+1] += transfer;
a[i] -= 2*transfer;
}
}
ll n = a.size();
vector<vector<ll>> dp(n, vector<ll>(4));
dp.back()[0] = 1; dp.back()[1] = 2;
dp.back()[2] = 3; dp.back()[3] = 4;
for (int i = n-2; i >= 0; i--) {
dp[i][0] = dp[i+1][a[i+1]];
dp[i][1] = 2*dp[i+1][a[i+1]];
dp[i][2] = dp[i+1][a[i+1]] + dp[i+1][a[i+1]+1];
dp[i][3] = 2*dp[i+1][a[i+1]+1];
}
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... |