This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int K = 61, MX = 1e5 + 1;
long long count_tastiness(long long x, std::vector<long long> a) {
if(x > MX) {
return 1;
}
const int k = a.size();
ll ans = 1;
for(ll y = 1; y*x <= MX; ++y) {
vector<long long> acpy = a;
bool ok = true;
for(int round = 0; round < x; ++round) {
ll cur = y;
for(int b = k - 1; b >= 0; --b) {
int can_take = min(a[b], cur >> b);
a[b] -= can_take;
cur -= (can_take << b);
}
if(cur > 0) {
ok = false;
break;
}
}
a = acpy;
if(ok) {
// cout << "counted " << y << endl;
ans++;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |