Submission #303393

# Submission time Handle Problem Language Result Execution time Memory
303393 2020-09-20T09:31:22 Z qiangbao Packing Biscuits (IOI20_biscuits) C++14
0 / 100
2 ms 384 KB
#include <iostream>
#include <vector>
#include "biscuits.h"

using namespace std;

typedef long long ll;

ll ways[64];

ll pow2[64];

void ini()
{
    ll i;
    
    pow2[0]=1;
    for(i=1;i<=63;i++)
        pow2[i]=pow2[i-1]*2;
    for(i=0;i<=63;i++)
        ways[i]=0;
    ways[0]=1;
}

ll count_tastiness(ll x, vector<ll> a)
{
    ll tot=0;
    ll i, j;
    
    ini();
    
    for(i=0;i<a.size();i++){
        ll way=0;
        tot+=a[i]*pow2[i];
        ll tot2=tot;
        for(j=i;j>=0;j--)
            if(tot2>=x*pow2[j])
                tot2-=x*pow2[j], way+=ways[j];
        ways[i+1]=way+1;
    }
    
    return ways[a.size()];
}

Compilation message

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:32:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(i=0;i<a.size();i++){
      |             ~^~~~~~~~~
# 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 1 ms 288 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 2 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 -