(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 #402952

#TimeUsernameProblemLanguageResultExecution timeMemory
402952phathnvPacking Biscuits (IOI20_biscuits)C++14
100 / 100
76 ms1324 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long ll; ll x, s[61]; map<ll, ll> mp[61]; ll Calc(int bit, ll n){ if (n < 1) return 0; if (bit == -1) return 1; n = min(n, min((ll) 2 << bit, s[bit] / x + 1)); if (mp[bit].count(n)) return mp[bit][n]; ll res = 0; res = Calc(bit - 1, n - ((ll) 1 << bit)) + Calc(bit - 1, n); mp[bit][n] = res; return res; } long long count_tastiness(long long _x, std::vector<long long> a) { x = _x; for(int i = 0; i <= 60; i++){ s[i] = 0; if (i < (int) a.size()) s[i] = a[i] * ((ll) 1 << i); if (i) s[i] += s[i - 1]; mp[i].clear(); } return Calc(60, (ll) 1 << 60); }
#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...