Submission #1023537

#TimeUsernameProblemLanguageResultExecution timeMemory
1023537Ahmed_SolymanPacking Biscuits (IOI20_biscuits)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll count_tastiness(ll x,vector<ll> a){
    if(x==1){
        while(a.size()<=60)a.push_back(0);-
        ll ans=1;
        int j=0;
        for(int i=0;i<60;i++){
            if(!a[i])ans*=1LL<<i-j,j=i+1;
            else{
                if(a[i]>=3)a[i+1]+=a[i]>>1LL;
            }
        }
        return ans;
    }
    if(x>100000)return 1;
    int k=(int)a.size();
    vector<ll>g=a;
    int ret=0;
    for(int y=0;y<=100000/x+5;y++){
        a=g;
        int cnt=0;
        for(int j=0;j<x;j++){
            ll u=y;
            for(int p=k-1;p>=0;p--){
                ll t=min(a[p],u/(1LL<<p));
                a[p]-=t;
                u-=t*(1LL<<p);
            }
            if(!u)++cnt;
        }
        ret+=(cnt==x);
    }
    return ret;
}

Compilation message (stderr)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:8:9: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
    8 |         while(a.size()<=60)a.push_back(0);-
      |         ^~~~~
biscuits.cpp:8:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
    8 |         while(a.size()<=60)a.push_back(0);-
      |                                           ^
biscuits.cpp:9:12: error: expected primary-expression before 'ans'
    9 |         ll ans=1;
      |            ^~~
biscuits.cpp:12:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |             if(!a[i])ans*=1LL<<i-j,j=i+1;
      |                      ^~~
      |                      abs
biscuits.cpp:12:33: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   12 |             if(!a[i])ans*=1LL<<i-j,j=i+1;
      |                                ~^~
biscuits.cpp:17:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         return ans;
      |                ^~~
      |                abs