Submission #547520

#TimeUsernameProblemLanguageResultExecution timeMemory
547520LucaDantasPacking Biscuits (IOI20_biscuits)C++17
44 / 100
212 ms3788 KiB
#include "biscuits.h" #include <cassert> #include <algorithm> #include <cstdio> long long count_tastiness(long long x, std::vector<long long> a) { std::vector<long long> val(200000); int pos = 1; while(a.size() < 60) a.push_back(0); for(int i = 1; i < (int)a.size(); i++) a[i] = (1ll << i) * a[i] + a[i-1]; for(int i = 0; i < 60; i++) { long long pot = (1ll << i), lim = a[i] / x; int last = pos; // int last = std::upper_bound(val.begin(), val.begin()+pos, a[i] / x - (1ll << i)) - val.begin(); for(int j = 0; j < last && (val[j] | pot) <= lim; j++) val[pos++] = val[j]|pot; } return pos; }
#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...