Submission #817721

#TimeUsernameProblemLanguageResultExecution timeMemory
817721Theo830Packing Biscuits (IOI20_biscuits)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define f(i,a,b) for(int i = a;i < b;i++) #define ll long long #define ii pair<ll,ll> #define pb push_back #define F first #define S second #define iii pair<ll,ii> #include "biscuits.h" map<ii,ll>dp; ll a[60] = {0}; ll solve(ll extra,ll j){ if(j >= 60){ return 1; } if(dp.count(ii(extra,j))){ return dp[{extra,j}]; } extra += a[j]; ll ans = solve(extra / 2,j+1); if(extra >= x){ ans += solve((extra - x) / 2,j+1); } extra -= a[j]; return dp[{extra,j}] = ans; } long long count_tastiness(long long x, vector<long long> A){ dp.clear(); ll k = A.size(); f(i,0,k){ a[i] = A[i]; } return solve(0,j); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int solve(long long int, long long int)':
biscuits.cpp:22:17: error: 'x' was not declared in this scope
   22 |     if(extra >= x){
      |                 ^
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:34:20: error: 'j' was not declared in this scope
   34 |     return solve(0,j);
      |                    ^