# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
613950 | penguinhacker | Packing Biscuits (IOI20_biscuits) | C++17 | 1085 ms | 340 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]/=x;
/*vector<ar<ll, 2>> dp(60);
for (int i=0; i<60; ++i) {
dp[i][0]=i?dp[i-1][0]+dp[i-1][1]:1;
if (v[i]>=(1ll<<i+1)-1)
dp[i][1]=dp[i][0];
else if (v[i]>=1ll<<i)
dp[i][1]=(v[i]==1ll<<i)?1:dp[63-__builtin_clzll(v[i]-(1ll<<i))][1]+dp[63-__builtin_clzll(v[i]-(1ll<<i))][0];
//if (i<3)
// cout << dp[i][0] << " " << dp[i][1] << endl;
}
return dp[59][0]+dp[59][1];*/
int ans=0;
for (int i=0; i<=100000; ++i) {
bool ok=1;
for (int j=0; j<30; ++j) {
if ((i&(1<<j+1)-1)>v[j]) {
ok=0;
break;
}
}
ans+=ok;
}
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... |