Submission #605409

#TimeUsernameProblemLanguageResultExecution timeMemory
605409gagik_2007Packing Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms340 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef ll itn; #define ff first #define ss second ll n; ll lg; ll ans=0; map<int, int>dp[2]; ll count_tastiness(ll x, vector<ll> a) { ans=0; n = a.size(); ll sum = 0; for (int i = 0; i < n; i++) { sum += a[i] * (1ll << i); } dp[0][0]=1; for(int i=0;i<n;i++){ for(auto c:dp[0]){ if(c.ff+a[i]-x>=0){ dp[1][(c.ff+a[i]-x)/2]+=c.ss; } dp[1][(c.ff+a[i])/2]+=c.ss; } dp[0]=dp[1]; dp[1].clear(); } for(auto c:dp[0]){ ans+=c.ss; } dp[0].clear(); return ans; } /* 2 3 2 2 1 2 3 2 2 1 2 */
#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...