Submission #306130

#TimeUsernameProblemLanguageResultExecution timeMemory
306130SorahISAPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1093 ms384 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define int long long using pii = pair<int, int>; template<typename T> using Prior = priority_queue<T>; template<typename T> using prior = priority_queue<T, vector<T>, greater<T>>; #define X first #define Y second #define ALL(x) (x).begin(), (x).end() #define eb emplace_back #define pb push_back int count_tastiness(int x, vector<int> a) { int k = a.size(); int ans = 1, sum = 0; for (int i = 0; i < k; ++i) sum += a[i] << i; for (int i = 1; i <= sum/x; ++i) { vector<int> cp = a; int cnt = 0; for (int j = 0; j < x; ++j) { for (int l = k-1, v = i; l >= 0; --l) { if ((v >> l) and cp[l]) { if ((v >> l) >= cp[l]) v -= cp[l] << l, cp[l] = 0; else v -= (v >> l) << l, cp[l] -= v >> l; } if (v == 0) {++cnt; break;} } } ans += cnt == x; } 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...