# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
305772 | daniel920712 | Packing Biscuits (IOI20_biscuits) | C++14 | 1097 ms | 4120 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 <stdio.h>
#include <string.h>
#include <set>
using namespace std;
long long con[105]={0},N,x;
set < long long > all;
void F(long long here,long long c,long long now)
{
//printf("%lld %lld %lld\n",here,c,now);
if(here>=N&&c==0) return ;
if(c>=x)
{
all.insert(now+(long long) (1<<here));
F(here+1,(c-x)/2+con[here+1],now+(long long) (1<<here));
}
if(c>=2*x)
{
all.insert(now+2*(long long) (1<<here));
F(here+1,(c-2*x)/2+con[here+1],now+2*(long long) (1<<here));
}
F(here+1,c/2+con[here+1],now);
}
long long count_tastiness(long long x,vector<long long> a)
{
all.clear();
long long ans=1,t=0,i,now,tt=0;
N=a.size();
::x=x;
for(i=0;i<N;i++) con[i]=a[i];
all.insert(0);
F(0,con[0],0);
return (long long) all.size();
}
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... |