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;
typedef long long int ll;
int n;
ll count_tastiness(ll x, vector<ll> a){
n = a.size();
ll ans = 0;
int sum = 0;
for(int i = 0; i < n; ++i) sum += (1<<i) * a[i];
for(ll y = 0; y <= sum / x; ++y){
ll c = 0;
bool ok = 1;
for(ll j = 0; j < 63; ++j){
if((1ll<<j)&y){
c += a[j];
if(c<x){
ok = 0;
break;
}
c-=x;
}else{
c += a[j];
}
c >>= 1;
}
if(ok) ans++;
}
return ans;
}
# | 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... |