Submission #467073

#TimeUsernameProblemLanguageResultExecution timeMemory
467073armandPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1094 ms332 KiB
#include "biscuits.h" #include <algorithm> using namespace std; int check_y(long long x, std::vector<long long> a, int y) { int i; vector<int> b; i = 0; while (y) { b.push_back(y % 2); y = y >> 1; } while (b.size() > a.size()) a.push_back(0); i = b.size()-1; while (i) { if (a[i] < 0) { a[i - 1] += 2 * a[i]; a[i] = 0; } if (b[i]) { if (a[i] < x) a[i - 1] -= 2 * (x - a[i]); } i--; } if(b[0]) return a[0] >= x; return a[0] >= 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; } for (int y = 1; y*x <= 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...