Submission #834667

#TimeUsernameProblemLanguageResultExecution timeMemory
834667JohannPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1076 ms3540 KiB
#include "biscuits.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() ll X; ll A[200200]; long long count_tastiness(long long _X, std::vector<long long> a) { X = _X; vector<ll> S(sz(a) + 1, 0); ll base = 1; for (int i = 0; i < sz(a); ++i) { S[i] += a[i] * base; S[i + 1] += S[i]; base *= 2; } ll ans = 1; A[0] = 0; base = 1; for (int i = 0; base * X <= S.back(); ++i) { ll size = ans; ll bound = (i < sz(S)) ? S[i] : S.back(); for (int j = 0; j < size; ++j) { ll y = A[j]; if ((y + base) * X <= bound) A[ans++] = y + base; } base *= 2; } 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...