Submission #306022

#TimeUsernameProblemLanguageResultExecution timeMemory
306022eriksuenderhaufPacking Biscuits (IOI20_biscuits)C++17
0 / 100
69 ms21136 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int)(x).size() unordered_map<ll,ll> dp[65]; void dfs(int d, ll p, ll& ret, ll x, vector<ll>& a) { if (d > 60) return; p = p / 2 + (d < sz(a) ? a[d] : 0); if (dp[d].count(p)) { ret += dp[d][p]; return; } ll t = ret; dfs(d + 1, p, ret, x, a); if (p >= x) { ret++; dfs(d + 1, p - x, ret, x, a); } dp[d][p] = ret - t; } ll count_tastiness(ll x, vector<ll> a) { int k = sz(a); vector<vector<int>> dp(k+1, vector<int>(k+1, 0)); for (int i = 0; i <= 60; i++) dp[i].clear(); ll ret = 1; dfs(0, 0, ret, x, a); return ret; }
#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...