Submission #400000

#TimeUsernameProblemLanguageResultExecution timeMemory
400000faresbasbsPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; map<pair<int,long long>,long long> dp; vector<long long> a; int x; long long ans(int curr , long long val){ if(curr == a.size()){ return 1; } val += a[curr]; if(dp.find({curr,val}) != dp.end()){ return dp[{curr,val}]; } long long ret = ans(curr+1,val/2); if(val >= x){ ret += ans(curr+1,(val-x)/2); } return dp[{curr,val}] = ret; } long long count_tastiness(long long X , vector<long long> A){ dp.clear(); a = A , x = X; return ans(0,0); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int ans(int, long long int)':
biscuits.cpp:9:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  if(curr == a.size()){
      |     ~~~~~^~~~~~~~~~~
#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...