Submission #306023

#TimeUsernameProblemLanguageResultExecution timeMemory
306023eriksuenderhaufPacking Biscuits (IOI20_biscuits)C++17
21 / 100
1091 ms41900 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); for (int i = 0; i <= 60; i++) dp[i].clear(); ll ret = 1; dfs(0, 0, ret, x, a); return ret; }

Compilation message (stderr)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:27:7: warning: unused variable 'k' [-Wunused-variable]
   27 |   int k = sz(a);
      |       ^
#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...