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;
#define int long long
#define SZ(x) ((int)(x).size())
#define all(x) begin(x), end(x)
bool chk(int v, int x, vector<int> cnt) {
for(int i = 0; i < x; i++) {
int val = v;
for(int j = SZ(cnt) - 1; j >= 0; j--) {
int need = min(cnt[j], val / (1LL << j));
cnt[j] -= need; val -= (1ll << j) * need;
}
if(val) return false;
}
return true;
}
int count_tastiness(int x, vector<int> a) {
int k = 60;
a.resize(k);
int ret = 0;
vector<int> tmp, S(k);
for(int i = 0; i < k; i++) {
tmp = a;
for(int j = 0; j < i; j++) {
if(j == k - 1) break;
tmp[j + 1] += tmp[j] / 2LL;
tmp[j] = 0;
}
for(int j = i; j < k - 1; j++) {
if(tmp[j] > x) {
int cnt = tmp[j] - x;
tmp[j + 1] += cnt / 2;
tmp[j] = x;
}
}
S[i] = 0;
for(int j = 0; j < k; j++) {
if(tmp[j] >= x) {
S[i] |= 1LL << j;
}
}
//printf("%lld%c", S[i], " \n"[i == k - 1]);
}
set<int> st;
for(int i = 0; i < k; i++) {
int x = S[i];
while(x) {
//printf("add %lld\n", x);
st.insert(x);
x = (x - 1) & S[i];
}
}
ret = st.size() + 1;
return ret;
}
# | 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... |