Submission #336640

#TimeUsernameProblemLanguageResultExecution timeMemory
336640cheehengPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1083 ms384 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long b[65]; long long count_tastiness(long long x, std::vector<long long> a) { long long S = 0; int k = (int)a.size(); for(int i = 0; i < k; i ++){ S += (a[i]<<i); } if(x == 1){ return 1LL<<__builtin_popcountll(S); } long long ans = 1; for(long long y = 1; y <= S/x; y ++){ bool boleh = true; for(int j = 0; j < k; j ++){ b[j] = a[j]; } for(long long i = 0; i < x; i ++){ long long rem = y; for(int j = k-1; j >= 0; j --){ long long quotient = min(rem>>j, b[j]); b[j] -= quotient; rem -= (quotient << j); } if(rem != 0){ boleh = false; break; } } ans += boleh; } 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...