# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1090708 | onlk97 | Packing Biscuits (IOI20_biscuits) | C++14 | 126 ms | 436 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;
long long count_tastiness(long long x,vector <long long> a){
long long sum=0;
for (long long i=0; i<a.size(); i++) sum+=a[i]*(1LL<<i);
if (sum<=100000){
int ans=1;
for (int tar=1; tar<=sum/x; tar++){
vector <long long> v=a;
bool ok=1;
for (int i=1; i<=x; i++){
long long rem=tar;
for (int j=a.size()-1; j>=0; j--){
long long g=min(rem/(1ll<<j),v[j]);
rem-=g*(1ll<<j);
v[j]-=g;
}
if (rem){
ok=0;
break;
}
}
if (ok) ans++;
}
return ans;
} else if (x==1){
long long ans=1,sum=0,st=0;
for (long long i=0; i<a.size(); i++){
sum+=1LL*a[i]*(1ll<<i);
if (sum<(1ll<<(i+1))){
ans*=(sum/(1ll<<st)+1);
sum=0;
st=i+1;
}
}
ans*=(sum/(1ll<<st)+1);
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... |