Submission #601841

#TimeUsernameProblemLanguageResultExecution timeMemory
601841FatihSolakPacking Biscuits (IOI20_biscuits)C++17
44 / 100
165 ms3544 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define N 200005 using namespace std; long long vals[N]; long long count_tastiness(long long x, vector<long long> a){ int k = a.size(); vector<long long> pre = a; for(int i = 1;i<k;i++){ pre[i] = pre[i-1] + a[i] * (1ll<<i); } for(int i = 0;i<k;i++){ pre[i] /= x; } for(int i = k-2;i>=0;i--){ pre[i] = min(pre[i],pre[i+1]); } while(pre.size() < 60) pre.push_back(pre.back()); vals[0] = 0; int sz = 1; for(int i = 0;i<60;i++){ int tmp = sz; for(int j = 0;j<tmp;j++){ if(vals[j] + (1ll<<i) <= pre[i]){ vals[sz++] = vals[j] + (1ll<<i); } else break; } } long long ans = sz; return ans; }
#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...