# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
457915 | rainboy | Packing Biscuits (IOI20_biscuits) | C++17 | 37 ms | 332 KiB |
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"
using namespace std;
typedef vector<long long> vll;
const int N = 60, Z = 100000;
long long max(long long a, long long b) { return a > b ? a : b; }
long long count_tastiness(long long x, vll aa) {
int n = aa.size(), i, cnt;
long long y;
if (x != 1) {
cnt = 0;
for (y = 0; x * y <= Z; y++) {
long long a = 0;
for (i = N - 1; i >= 0; i--) {
if ((y & 1LL << i) != 0)
a += x;
a = max(a - (i < n ? aa[i] : 0), 0) * 2;
}
if (a == 0)
cnt++;
}
} else {
long long a;
int i, j;
cnt = 1, a = 0;
for (i = 0, j = 0; j <= N; j++) {
if (j < n)
a += aa[j] << j - i;
if (a < 1LL << j - i + 1)
cnt *= (a + 1), a = 0, i = j + 1;
}
}
return cnt;
}
Compilation message (stderr)
# | 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... |