(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #308304

#TimeUsernameProblemLanguageResultExecution timeMemory
308304bruce_testPacking Biscuits (IOI20_biscuits)C++14
100 / 100
87 ms1020 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second #define lc (rt<<1) #define rc (rt<<1|1) #define pb push_back #define cl(a, b) memset(a, b, sizeof(a)) typedef long long ll; typedef pair<int, int> pi; typedef pair<int, pi> pii; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pi> vii; typedef vector<pii> viii; const int inf = 0x3F3F3F3F; const ll infl = 0x3F3F3F3F3F3F3F3FLL; const int mod = 1e9 + 7, LOG=60; ll cnt, psa[LOG]; map<ll, ll> mp; ll fun(ll x){ if(x < 0) return 0; if(mp.count(x)) return mp[x]; if(x == 0) return mp[0]=1LL; int p = 63 - __builtin_clzll(x); mp[x] = fun((1LL<<p)-1) + fun(min(x, psa[p]/cnt) - (1LL<<p)); return mp[x]; } ll count_tastiness(ll x, vl a){ a.resize(LOG); cnt = x; mp.clear(); psa[0] = a[0]; for(int i=1; i<LOG; i++) psa[i] = psa[i-1] + a[i]*(1LL<<i); return fun((1LL<<LOG) - 1); } //int main(){ // ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); // vl a = {5, 2, 1}; // cout << count_tastiness(3, a) << endl; //}
#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...