Submission #306042

#TimeUsernameProblemLanguageResultExecution timeMemory
306042eriksuenderhaufPacking Biscuits (IOI20_biscuits)C++17
33 / 100
1242 ms1888152 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define sz(x) (int)(x).size() ll count_tastiness(ll x, vector<ll> a) { while (sz(a) < 60) a.push_back(0); ll ret = 1; vector<vector<ll>> dp(61, vector<ll>(2*x+1, 0)); dp[0][0] = 1; ll pref = 0; for (int i = 0; i < 60; i++) { pref = pref / 2 + a[i]; for (int j = 0; j <= min(pref,x); j++) if (dp[i][j] != 0) { dp[i+1][pref / 2 - (pref-j) / 2] += dp[i][j]; if (pref - j >= x) { ret += dp[i][j]; dp[i+1][pref/2-(pref-j-x)/2] += dp[i][j]; } } } 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...