# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
780878 | Josia | Packing Biscuits (IOI20_biscuits) | C++17 | 1 ms | 596 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 int long long
long long count_tastiness(long long x, std::vector<long long> a) {
assert(x==1);
vector<int> b(100, 0);
int carry = 0;
for (int i = 0; i<b.size(); i++) {
carry /= 2;
int here = carry+(i<a.size()?a[i]:0);
if (here == 0) continue;
if (here%2==0) {
b[i] = 2;
carry = here - 2;
} else {
b[i] = 1;
carry = here - 1;
}
}
int res = 1;
bool cont = 1;
int lastCont = 0;
int addup = 0;
for (int i=0; i<62; i++) {
if (!b[i]) {
// lastCont = 0;
res += addup;
addup = 0;
continue;
}
res *= 2;
if (b[i] == 2) addup += 1<<lastCont;
lastCont ++;
}
res += addup;
return res;
}
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... |