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

#TimeUsernameProblemLanguageResultExecution timeMemory
422720MazaalaiPacking Biscuits (IOI20_biscuits)C++14
100 / 100
96 ms844 KiB
#include "biscuits.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; map<ll, ll> m; int firstBit(ll a) { for (int i = 60; i > 0; i--) { if (1ll<<i & a) return i; } return 0; } ll f(vector<ll> &s, ll x, ll n) { if(n <= 0) return 0; if(m.count(n)) return m[n]; ll a = firstBit(n-1); return m[n] = f(s,x,1LL<<a) + f(s,x,min(n,1+s[a]/x)-(1LL<<a)); } long long count_tastiness(long long x, vector<long long> a) { m.clear(); a.resize(63, 0); for(int i=1; i<(int)a.size(); i++) { a[i] = a[i-1] + (a[i]<<i); } m[1] = 1; return f(a, x, 1+a.back()); }
#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...