Submission #304612

#TimeUsernameProblemLanguageResultExecution timeMemory
304612medmdgPacking Biscuits (IOI20_biscuits)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
long long int count_tastiness(long long int x,long long int[] a){
    long long int b[61];
    int k=61;
    bool an[k];
    memset(b,0,b.size());
    for(int i=0;i<a.size();i++)
        b[i]=a[i];
    memset(an,false,k);
    for(int i=0;i<61;i++){
        if(b[i]>=x){
            an[i]=true;
            b[i]-=x;
        }else{
            an[i]=false;
        }
        b[i+1]+=b[i]/2;
        b[i]=0; 
    }
    unsigned long long int ans=0;
    for(int i=0;i<61;i++){
        if(an[i])
            ans+=1<<i;
    }
    return ans;
}

Compilation message (stderr)

biscuits.cpp:4:63: error: expected ',' or '...' before 'a'
    4 | long long int count_tastiness(long long int x,long long int[] a){
      |                                                               ^
biscuits.cpp: In function 'long long int count_tastiness(long long int, long long int*)':
biscuits.cpp:8:18: error: request for member 'size' in 'b', which is of non-class type 'long long int [61]'
    8 |     memset(b,0,b.size());
      |                  ^~~~
biscuits.cpp:9:19: error: 'a' was not declared in this scope
    9 |     for(int i=0;i<a.size();i++)
      |                   ^