Submission #672786

#TimeUsernameProblemLanguageResultExecution timeMemory
672786tbzardPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1119 ms1051128 KiB
#include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, vector<long long> a){ long double b = 1, sum = 0; vector<long double> ans; ans.push_back(0); for(int i=0;i<100;i++){ if(i<a.size()) sum += b*a[i]; int m = upper_bound(ans.begin(), ans.end(), sum/x-b)-ans.begin()-1; for(int j=0;j<=m;j++) ans.push_back(ans[j]+b); b*=2; } return (long long)ans.size(); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:8:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |         if(i<a.size()) sum += b*a[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...