Submission #303862

# Submission time Handle Problem Language Result Execution time Memory
303862 2020-09-20T17:30:35 Z Pajaraja Packing Biscuits (IOI20_biscuits) C++17
0 / 100
4 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))
        {
            bool fas=false;
            for(long long j=i;j>=0;j--) if((1LL<<j)&mx)
            {
                dpu[i]+=(j!=0)?dp[j-1]:1;
                long long nx=(p[j]-(x<<j))/x;
                if(p[j]<(x<<j)) {fas=true; break;}
                mx^=(1LL<<j);
                if(nx<mx) {dpu[i]+=dpu[j]; fas=true; break;}
            }
            if(!fas) dpu[i]++;
        }
        dp[i]=(i!=0)?dp[i-1]:1;
        dp[i]+=dpu[i];
    }
	return dp[k-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 4 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 -