Submission #824078

#TimeUsernameProblemLanguageResultExecution timeMemory
824078drdilyorPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1110 ms1137248 KiB
#include<bits/stdc++.h> #include "biscuits.h" using namespace std; using ll = long long; const int T = 120; long long count_tastiness(long long x, std::vector<long long> a) { int k = a.size(); int ans = 0; int sum = 0; for (int i = 0; i < k; i++) sum += a[i] << i; vector<int> vals; for (int i = 0; i < k;i ++) { for (int j = 0; j < a[i]; j++) vals.push_back(1 << i); } for (int y = 0; y <= sum / x; y++) { auto b = a; vector<int> done(x, 0); int j = 0; for (int i = k-1; i >= 0; i--) { for (int jj = 0; jj < k; jj++) { ll diff = y - done[j]; ll need = diff >> i; ll use = min(need, b[i]); b[i] -= use; done[j] += use << i; j++; j %= x; if (b[i] == 0) break; } } bool ok = true; for (int i : done) ok &= i == y; ans += ok; } 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...