Submission #672785

#TimeUsernameProblemLanguageResultExecution timeMemory
672785tbzard비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1119 ms788292 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); int cnt = 0; for(int i=0;i<100;i++){ if(i<a.size()) sum += b*a[i]; vector<long double> add; int j = upper_bound(ans.begin(), ans.end(), sum/x-b) - ans.begin(); j--; for(;j>=0;j--) add.push_back(ans[j]+b); reverse(add.begin(), add.end()); for(int j=0;j<add.size();j++) ans.push_back(add[j]); 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:9:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         if(i<a.size()) sum += b*a[i];
      |            ~^~~~~~~~~
biscuits.cpp:15:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |         for(int j=0;j<add.size();j++) ans.push_back(add[j]);
      |                     ~^~~~~~~~~~~
biscuits.cpp:7:9: warning: unused variable 'cnt' [-Wunused-variable]
    7 |     int cnt = 0;
      |         ^~~
#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...