Submission #304620

#TimeUsernameProblemLanguageResultExecution timeMemory
304620medmdgPacking Biscuits (IOI20_biscuits)C++14
0 / 100
2 ms384 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; long long int count_tastiness(long long int x,vector<long long int> a){ vector<long long int> b; int k=62; bool an[k]; for(int i=0;i<a.size();i++) b.push_back(a[i]); for(int i=0;i<62;i++){ while(b.size()<=i){ b.push_back(0); } 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<62;i++){ if(an[i]) ans+=1<<i; } 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:8:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i=0;i<a.size();i++)
      |                 ~^~~~~~~~~
biscuits.cpp:11:23: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |         while(b.size()<=i){
      |               ~~~~~~~~^~~
#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...