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>
typedef long long ll;
using namespace std;
constexpr ll maxLog = 62;
ll count_tastiness(ll x, vector<ll> a) {
ll res = 1;
for(ll y = 1; y <= 200000; y++) {
vector<bool> bits;
ll latestBit = 0;
for(ll i = 0; i < maxLog; i++) {
if(y&(1ll<<i)) {
latestBit=i;
}
}
vector<ll> b;
for(auto i : a)b.push_back(i);
for(int i = a.size(); i <= 61; i++)b.push_back(0);
bool pos = true;
for(ll i = latestBit; i >= 0; i--) {
if(y&(1<<i)) {
ll need = x;
need = max(0ll, need-b[i]);
if(need==0)continue;
else {
for(ll z = i-1; z >= 0; z--) {
need*=2;
ll mn = min(need, b[z]);
need-=mn;
b[z]-=mn;
if(need==0)break;
}
if(need!=0) {
pos=false;
break;
}
}
}
}
if(pos)res++;
}
return res;
}
# | 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... |