# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
614186 | penguinhacker | Packing Biscuits (IOI20_biscuits) | C++17 | 23 ms | 1364 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 ll long long
#define ar array
ll count_tastiness(ll x, vector<ll> a) {
vector<ll> v(60);
for (int i=0; i<a.size(); ++i)
v[i]+=(1ll*a[i])<<i;
for (int i=1; i<60; ++i)
v[i]+=v[i-1];
for (int i=0; i<60; ++i)
v[i]=min(v[i]/x, (1ll<<i+1)-1);
vector<vector<ll>> dp(60, vector<ll>(60));
for (int i=0; i<60; ++i) {
for (int j=i; j<60; ++j) {
ll mask=v[j]&((1ll<<i+1)-1);
if (!i) {
dp[i][j]=mask+1;
continue;
}
if (mask&1ll<<i)
dp[i][j]=dp[i-1][i-1]+dp[i-1][mask-(1ll<<i)<=v[i-1]?j:i-1];
else
dp[i][j]=dp[i-1][mask<=v[i-1]?j:i-1];
}
}
return dp[59][59];
}
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... |