Submission #313809

#TimeUsernameProblemLanguageResultExecution timeMemory
313809srvltPacking Biscuits (IOI20_biscuits)C++17
9 / 100
105 ms384 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define ll long long #define pb push_back #define SZ(x) (int)(x).size() #define all(x) begin(x), end(x) using namespace std; const int n0 = 1e5; ll count_tastiness(ll x, vector<ll> a) { ll s = 0; for (ll i = 0; i < SZ(a); i++) s += (1ll << i) * a[i]; if (x > s) return 1; ll res = 0; if (s <= n0) { for (ll i = 0; i <= s; i++) { ll cur = 0; for (ll j = 59; j >= 0; j--) { if (i >> j & 1) cur += x; if (j < SZ(a)) cur -= min(cur, a[j]); cur *= 2; } res += (cur == 0); } } else if (x == 1) { ll r = 0, res = 1; for (ll j = 0; j < 60; j++) { if (!a[j]) continue; if ((1ll << j) <= r + 1) r += a[j] * (1ll << j); else { res *= (r + 1); r = 0; } } } return res; }
#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...