This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define readl(_s) getline(cin, (_s));
#define boost() cin.tie(0); cin.sync_with_stdio(0)
const int MN = 65;
int k, psa[MN];
int count_tastiness(int x, vector<int> a) {
k = a.size();
psa[0] = a[0];
for (int i = 1; i < k; i++) {
psa[i] = a[i] * (1ll << i) + psa[i - 1];
//printf("%d\n", psa[i]);
}
for (int i = k; i < 63; i++) psa[i] = psa[i - 1];
vector<int> ans;
ans.push_back(0);
//if (psa[0] >= x) ans.insert(1);
for (int i = 0; i < 63; i++) {
vector<int> tmp;
for (int val : ans) {
int y = val + (1ll << i);
//printf("%lld\n", y);
if (psa[i] / x >= y) tmp.push_back(y);
}
for (int p : tmp) ans.push_back(p);
}
/*for (int i = 1; i <= 1000000; i++) {
int b = 0;
for (int s = 0; s < 30; s++) if (i & (1 << s)) b = s;
if (psa[b] >= x * i && ans.count(i - (1 << b))) ans.insert(i);
}*/
return (ll) ans.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... |