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

#TimeUsernameProblemLanguageResultExecution timeMemory
304991Wu_RenPacking Biscuits (IOI20_biscuits)C++14
100 / 100
68 ms1016 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; int n,m; long long sum[70]; map<long long,long long>dp[70];//第i层,上限为j long long dfs(int dep,long long lim){ lim=min(lim,min(sum[dep],(2ll<<dep)-1)); if(dp[dep].count(lim)) return dp[dep][lim]; long long _1=1ll<<dep,res=0; if(_1<=lim){ if(dep) res+=dfs(dep-1,lim-_1); else res++; } if(dep) res+=dfs(dep-1,lim); else res++; return dp[dep][lim]=res; } long long count_tastiness(long long x,vector<long long> a){ for(int i=0;i<=60;i++) sum[i]=((int)a.size()>i?a[i]<<i:0)+sum[i-1]; for(int i=0;i<=60;i++) dp[i].clear(),sum[i]/=x; return dfs(60,1ll<<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...