# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480097 | couplefire | Packing Biscuits (IOI20_biscuits) | C++17 | 58 ms | 1320 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int K = 60;
map<int, int> dp[K];
int bound[K];
int dfs(int pos, int bd){
if(bd<0) return 0; if(pos<0) return 1;
if(dp[pos].count(bd)) return dp[pos][bd];
return dp[pos][bd] = dfs(pos-1, min(bd, bound[pos-1]))+dfs(pos-1, min(bd-(1ll<<pos), bound[pos-1]));
}
int count_tastiness(int x, vector<int> cnt){
cnt.resize(K); int cur = 0;
for(int i = 0; i<K; ++i)
cur += cnt[i]*(1ll<<i), bound[i] = min(cur/x, (1ll<<(i+1))-1), dp[i].clear();
return dfs(K-1, bound[K-1]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |