# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1055547 | Trent | Packing Biscuits (IOI20_biscuits) | C++17 | 1132 ms | 1233320 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;
#define forR(i, x) for(int i = 0; i < (x); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<ll> vll;
long long count_tastiness(long long x, std::vector<long long> a) {
a.insert(a.begin(), (ll) 0);
int k = 60;
while(a.size() < k) a.push_back(0);
vll sm(k);
sm[0] = a[0];
REP(i, 1, k) sm[i] = sm[i-1] + (1LL << (i-1)) * a[i];
vll vals = {sm[k-1]};
for(int i = k - 1; i > 0; --i) {
vll nex;
for(ll j : vals) {
j = min(j, sm[i]);
nex.push_back(j);
if(j - (1LL << (i-1)) * x >= 0) nex.push_back(j - (1LL << (i-1)) * x);
}
vals.swap(nex);
}
return vals.size();
}
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... |