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

#TimeUsernameProblemLanguageResultExecution timeMemory
352396G_X_JPacking Biscuits (IOI20_biscuits)C++14
100 / 100
39 ms1388 KiB
#include <bits/stdc++.h> #include "biscuits.h" #define rep(i,a,b) for(int i=a;i<=b;++i) #define per(i,b,a) for(int i=b;i>=a;--i) #define ll long long #define vi vector<ll> using namespace std; unordered_map <ll, ll> mp; ll dp(ll n, ll x, const vi &s) { if(n <= 0) return 0; if(n == 1) return 1; if(mp.find(n)!=mp.end()) return mp[n]; ll power = 1ll << (__lg(n - 1)); return mp[n] = dp(power, x, s) + dp(min(n, 1 + s[__lg(n - 1)] / x) - power, x, s); } ll count_tastiness(ll x, vi a) { mp.clear(); rep(i,1,(int)(a.size()) - 1) a[i] = a[i - 1] + (a[i] << i);//calculate s[i] while(a.size() <= 60) a.push_back(a.back());//a[i] is 0, so s[i] = s[i-1] return dp(1 + a.back(), x, a); }//好jb短
#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...