Submission #1029517

#TimeUsernameProblemLanguageResultExecution timeMemory
1029517irmuunPacking Biscuits (IOI20_biscuits)C++17
9 / 100
1047 ms604 KiB
#include<bits/stdc++.h>
//#include "biscuits.h"
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

ll count_tastiness(ll x,vector<ll>a){
    ll ans=0;
    vector<ll>c(60,0);
    for(ll i=0;i<=100000;i++){
        if(i*x>(ll)1e18) break;
        fill(all(c),0);
        for(ll j=0;j<a.size();j++){
            c[j]=a[j];
        }
        bool can=true;
        for(ll j=0;j<60;j++){
            if(i&(1ll<<j)){
                if(c[j]<x){
                    can=false;
                    break;
                }
                c[j]-=x;
            }
            if(j<59){
                c[j+1]+=c[j]/2;
            }
        }
        if(can){
            ans++;
        }
    }
    return ans;
}

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:19:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(ll j=0;j<a.size();j++){
      |                    ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...