Submission #400002

#TimeUsernameProblemLanguageResultExecution timeMemory
400002faresbasbsPacking Biscuits (IOI20_biscuits)C++14
21 / 100
1095 ms52564 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; map<pair<int,long long>,long long> dp; vector<long long> a; long long x; long long ans(long long 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; while(a.size() < 60){ a.push_back(0ll); } return ans(0,0); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int ans(long long int, long long int)':
biscuits.cpp:9:10: warning: comparison of integer expressions of different signedness: 'long long 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...