Submission #1072630

#TimeUsernameProblemLanguageResultExecution timeMemory
1072630HD1Packing Biscuits (IOI20_biscuits)C++14
0 / 100
1049 ms25376 KiB
#include "biscuits.h" #include <iostream> #include <unordered_map> using namespace std; long long a[200],x; unordered_map<long long,long long> dp[200]; // dp[0][60] = 1 long long DP(int i,long long n){ if(n == 0 && i >= 60) return 1; if(dp[i][n] != 0) return dp[i][n]; long long ans = DP(i+1,(a[i]+n)/2); if(a[i] + n >= x) ans += DP(i+1,(a[i]+n-x)/2); cout << i << " " << a[i] << " " << n <<endl; return dp[i][n] = ans; } long long count_tastiness(long long xx, std::vector<long long> aa) { x = xx; for(int i = 0; i < aa.size(); i++) a[i] = aa[i]; long long ans = DP(0,0); for(int i = 0; i< 200; i++) dp[i].clear(), a[i] = 0; return ans; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i = 0;  i < aa.size(); i++) a[i] = aa[i];
      |                     ~~^~~~~~~~~~~
#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...