이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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, dp[MN], psa[MN];
int count_tastiness(int x, vector<int> a) {
k = a.size();
memset(dp, 0, sizeof(dp));
memset(psa, 0, sizeof(psa));
psa[0] = a[0];
for (int i = 1; i < k; i++) {
psa[i] = a[i] * (1 << i) + psa[i - 1];
//printf("%d\n", psa[i]);
}
set<int> ans;
ans.insert(0);
if (psa[0] >= x) ans.insert(1);
for (int i = 0; i < 30; i++) {
vector<int> tmp;
for (int val : ans) {
int y = val + (1 << i);
//printf("%d\n", y);
if (psa[i] >= x * y) tmp.push_back(y);
}
for (int p : tmp) ans.insert(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 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... |