# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1052440 | mychecksedad | Packing Biscuits (IOI20_biscuits) | C++17 | 783 ms | 2097156 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;
#define pb push_back
#define ll long long int
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define pii pair<int,int>
#define ff first
#define ss second
long long count_tastiness(long long x, std::vector<long long> a) {
a.resize(63);
vector<vector<ll>> dp(63, vector<ll>(x));
for(int i = 0; i + 1 < a.size(); ++i){
if(a[i] > x){
ll dif = (a[i] - x) / 2;
a[i + 1] += dif;
a[i] -= dif * 2;
}
}
ll k = a.size();
// vector<vector<int>> v;
// for(int i = 0; i < k; ++i){
// if(a[i] >= 1){
// if(i == 0 || a[i - 1] == 0) v.pb({a[i]});
// else v.back().pb(a[i]);
// }
// }
// ll ans = 1;
// for(auto u: v){
// ll x = 1;
// for(int i = u.size() - 1; i >= 0; --i){
// x *= 2;
// if(u[i] == 2) x += 1;
// }
// ans *= x;
// }
dp[0][0] = 1;
for(int i = 0; i < k - 1; ++i){
for(int j = 0; j < x; ++j){
dp[i + 1][j + a[i] >> 1] += dp[i][j];
if(j + a[i] >= x)
dp[i + 1][j + a[i] - x >> 1] += dp[i][j];
}
}
ll ans = 0;
for(int j = 0; j < x; ++j) ans += dp[k - 1][j];
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... |