# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829152 | definitelynotmee | Packing Biscuits (IOI20_biscuits) | C++17 | 0 ms | 0 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"grader.cpp"
#include<bits/stdc++.h>
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const ll INFL = 2e18;
using pll = pair<ll,ll>;
long long count_tastiness(long long x, std::vector<long long> a) {
a.resize(60,0);
int k = a.size();
vector<ll> ct(k);
ct[0] = a[0];
for(int i = 1; i < k; i++){
ct[i] = a[i]*(1ll<<i)+ct[i-1];
}
vector<ll> poss = {0};
poss.reserve(2e5);
for(int i = 0; i < k; i++){
if((1ll<<i)*x >= INFL)
break;
int n = poss.size();
for(int j = 0; j < n; j++){
if(ct[i]-poss[j]*x >= (1ll<<i)*x)
poss.push_back((1ll<<i)+poss[j]);
}
}
return poss.size();
}