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>
using namespace std;
#define vc vector
#define ll long long
#define loop(i, a, b) for(ll i=a;i<b;++i)
#define pool(i, a, b) for(ll i=a-1;i>=b;--i)
long long count_tastiness(long long x, vc<long long> a){
ll mk=62;
a.resize(mk);
vc<ll> dp(mk);
for(ll i=0, j=0;i<mk;++i, j=i-1){
while(j>=0 and j<i and a[i]<x){
ll rpot=((ll)1 << (i-j)), kok=min(max((ll)0, x-a[i]), a[j]/rpot);
a[i]+=kok, a[j]-=kok * rpot;
--j;
}
}
return dp[mk-1];
}
# | 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... |