# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1074519 | TheQuantiX | Packing Biscuits (IOI20_biscuits) | C++17 | 1067 ms | 348 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 <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
using ll = long long;
ll n, m, q, k, x, y, a, b, c;
long long count_tastiness(long long x, vector<long long> a) {
ll sum = 0;
for (int i = 0; i < a.size(); i++) {
sum += a[i] * (1 << i);
}
if (x == 1) {
ll ans = 0;
ll mx = 0;
for (int i = 0; i < a.size(); i++) {
if (mx < (1LL << i) - 1) {
ans += mx;
mx = 0;
}
mx += a[i] * (1LL << i);
}
ans += mx;
return ans;
}
ll ans = 1;
for (int i = 1; i <= sum / x; i++) {
vector<ll> arr = a;
bool fl = 1;
for (int j = 0; j < x; j++) {
ll e = i;
for (int k = arr.size() - 1; k >= 0; k--) {
ll x = min(e / (1LL << k), arr[k]);
arr[k] -= x;
e -= (1LL << k) * x;
}
if (e != 0) {
fl = 0;
break;
}
}
if (fl) {
// cout << i << '\n';
ans++;
}
}
return ans;
}
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... |