Submission #467004

#TimeUsernameProblemLanguageResultExecution timeMemory
467004armandPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1095 ms332 KiB
#include "biscuits.h" #include <algorithm> using namespace std; int check_y(long long x, std::vector<long long> a, int y) { long long i, k = a.size(); for (i = 0; i < k; i++) if ((1 << i) > y) break; i--; long long t = y * x; long long two = 1; while (i>=0) { long long p = t / two; t -= min(a[i], p)*two; if (t == 0) return 1; i--; two <<= 1; } return t == 0; } long long count_tastiness(long long x, std::vector<long long> a) { int res = 1; int k = a.size(); long long total = 0; long long two = 1; for (int i = 0; i < k; i++) { total += two*a[i]; two <<= 1; } if (total < x) return 1; for (int y = 1; y <= total; y++) res += check_y(x, a, y); return res; }
#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...