This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//Challenge: Accepted
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r){
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second
#include "biscuits.h"
long long count_tastiness(long long x, std::vector<long long> a) {
for (int i = 0;i < 60;i++) a.push_back(0);
int k = a.size();
for (int i = 0;i < k-1;i++) {
ll d = max(0LL, a[i] - x);
a[i] = min(x, a[i]);
a[i+1] += d/2;
}
vector<ll> v;
v.push_back(0);
for (int i = 0;i < k;i++) {
if (i < k) {
for (ll &j:v) j += a[i];
}
int tmp = v.size();
for (int j = 0;j < tmp;j++) {
if (v[j] >= x) v.push_back(v[j] - x);
}
for (ll &j:v) j /= 2;
}
return v.size();
}
# | 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... |