# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
818632 | kevinsogo | Packing Biscuits (IOI20_biscuits) | C++17 | 1 ms | 400 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>
using namespace std;
#include "biscuits.h"
using ll = long long;
using lll = __int128;
using seq = vector<lll>;
seq con(int n, lll v) {
return seq(n, v);
}
seq inc(seq s, lll a) {
for (lll& v: s) v += a;
return s;
}
seq conc(seq a, const seq& b, lll v = 0) {
assert(a.back() <= b.front());
a.insert(a.end(), b.begin(), b.end());
return inc(a, v);
}
seq drop(const seq& a, lll u = 0) {
int i = 0;
while (a[i] < u) i++;
return seq(a.begin() + i, a.end());
}
int size(const seq& s) {
return s.size();
}
ll count_tastiness(ll x, vector<ll> a) {
a.resize(a.size() + 3);
auto s = con(1, 0);
for (int i = 0; i < a.size(); i++) s = drop(conc(inc(s, lll(-x) << i), s, lll(a[i]) << i));
return size(s);
}
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... |