Submission #303841

# Submission time Handle Problem Language Result Execution time Memory
303841 2020-09-20T16:58:23 Z Pajaraja Packing Biscuits (IOI20_biscuits) C++17
0 / 100
3 ms 384 KB
#include "biscuits.h"
#include <bits/stdc++.h>
#define MAXN 67
using namespace std;
long long dp[MAXN],dpu[MAXN],p[MAXN];
long long count_tastiness(long long x, std::vector<long long> a)
{
    while(a.size()<60) a.push_back(0);
    int k=60;
    p[0]=a[0];
    for(long long i=1;i<k;i++) p[i]=p[i-1]+(a[i]<<i);
    for(long long i=0;i<k;i++)
    {
        long long mx=(p[i]-(x<<i))/x;
        dpu[i]=0;
        if(p[i]>=(x<<i))
        {
            dpu[i]=1;
            for(long long j=i;j>=0;j--) if((1LL<<j)&mx)
            {
                if(j!=0) dpu[i]+=dp[j-1];
                long long nx=(p[j]-(x<<j))/x;
                if(nx<mx) {dpu[i]+=dpu[j]; break;}
                mx^=(1LL<<j);
            }
        }
        dp[i]=(i!=0)?dp[i-1]:0;
        dp[i]+=dpu[i];
    }
	return dp[k-1]+1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -