# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773814 | t6twotwo | Packing Biscuits (IOI20_biscuits) | C++17 | 1068 ms | 340 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"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll count_tastiness(ll q, vector<ll> A) {
A.resize(61);
if (q == 1) {
map<ll, ll> mp;
mp[0] = 1;
for (int i = 0; i < A.size(); i++) {
map<ll, ll> t;
for (auto [add, x] : mp) {
t[(A[i] + add) / 2] += x;
if (A[i] + add >= q) {
t[(A[i] + add - q) / 2] += x;
}
}
swap(mp, t);
}
ll ans = 0;
for (auto [_, x] : mp) {
ans += x;
}
return ans;
}
int ans = 0;
for (ll i = 0; i <= 100000; i++) {
auto B = A;
ans++;
for (int j = 0; j < 60; j++) {
if (i >> j & 1) {
if (B[j] < q) {
ans--;
break;
}
B[j] -= q;
}
B[j + 1] += B[j] / 2;
}
}
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... |