Submission #1052819

#TimeUsernameProblemLanguageResultExecution timeMemory
1052819ProtonDecay314Packing Biscuits (IOI20_biscuits)C++17
9 / 100
1065 ms229448 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef vector<vpi> vvpi; typedef vector<vpll> vvpll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef short int si; typedef vector<si> vsi; typedef vector<vsi> vvsi; #define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++) #define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--) #define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++) #define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--) #define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci #define fi first #define se second #define pb push_back #define INF(type) numeric_limits<type>::max() #define NINF(type) numeric_limits<type>::min() #define TCASES int t; cin >> t; while(t--) ll count_tastiness(ll x, vll a) { vvll dp; ll MAX_X = 10'010ll; ll MAX_K = 60ll; set<ll> poss; poss.insert(0ll); for(ll i = 0ll; i <= MAX_K; i++) { vll dpr(MAX_X, 1ll); dp.pb(dpr); } // Extend a while((ll)a.size() < MAX_K) { a.pb(0ll); } // Remove excess for(ll i = 0ll; i < MAX_K; i++) { if(a[i] >= x + 2) { ll excess = a[i] - x; a[i + 1] += excess >> 1ll; a[i] -= (excess >> 1ll) << 1ll; } } ll s = 0ll; L(i, 0ll, MAX_K) { set<ll> to_union; s += a[i] << i; ll sdx = s / x; ll cur_p2 = 1ll << i; for(ll j : poss) { for(ll k = 1ll; j + cur_p2 * k <= sdx; k++) { to_union.insert(j + cur_p2 * k); } } for(ll j : to_union) poss.insert(j); } // cout << dp[0][0] << "\n"; // cout << flush; return poss.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...