Submission #308362

#TimeUsernameProblemLanguageResultExecution timeMemory
3083624fectaPacking Biscuits (IOI20_biscuits)C++14
0 / 100
2 ms384 KiB
#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] * (1ll << 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 < 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.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 (ll) ans.size(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...