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>
#pragma GCC optimize("O3")
#define endl '\n'
using namespace std;
long long count_tastiness(long long x, vector <long long> a) {
vector <long long> v;
v.push_back(0);
int sz = (int)a.size();
for (int i = 0; ; i++) {
for (auto &j: v)
j >>= 1ll;
if (i < sz)
for (auto &j: v)
j += a[i];
int old_sz = (int)v.size();
for (int j = 0; j < old_sz; j++)
if (v[j] >= x)
v.push_back(v[j] - x);
if ((int)v.size() == old_sz && i >= sz)
break;
}
return (int)v.size();
}
/*
int main() {
long long x, n;
cin >> x >> n;
vector <long long> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
cout << count_tastiness(x, a) << endl;
}
*/
# | 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... |