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

#TimeUsernameProblemLanguageResultExecution timeMemory
598427Jarif_RahmanPacking Biscuits (IOI20_biscuits)C++17
100 / 100
54 ms1324 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; const int K = 60; ll count_tastiness(ll X, vector<ll> A){ while(A.size() < K+1) A.pb(0); A.pb(0); vector<ll> S(K+1); for(int i = 0; i < K; i++){ if(i) S[i]+=S[i-1]; S[i]+=A[i]*(1LL<<i); } unordered_map<ll, ll> dp; dp[0] = 1; function<ll(ll)> DP = [&](ll x){ if(x < 0) return 0LL; if(dp.find(x) != dp.end()) return dp[x]; int i = 63-__builtin_clzll(x); dp[x] = DP((1LL<<i)-1)+DP(min(x, S[i]/X)-(1LL<<i)); return dp[x]; }; return DP(1LL<<K); }
#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...