Submission #433055

#TimeUsernameProblemLanguageResultExecution timeMemory
433055peuchPacking Biscuits (IOI20_biscuits)C++17
9 / 100
653 ms4332 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; vector<map<long long, long long> > dp; vector<int> v(60); long long X; long long getDP(int bit, long long cnt){ cnt += v[bit]; if(bit == 60) return 1; if(dp[bit][cnt] != 0) return dp[bit][cnt]; dp[bit][cnt] = getDP(bit + 1, cnt / 2); if(cnt >= X) dp[bit][cnt] += getDP(bit + 1, (cnt - X) / 2); // printf("dp[%d][%lld] = %d\n", bit, cnt, dp[bit][cnt]); return dp[bit][cnt]; } long long count_tastiness(long long x, vector<long long> a) { X = x; v = vector<int> (60, 0); dp = vector<map<long long, long long> > (60); for(int i = 0; i < a.size(); i++) v[i] = a[i]; return getDP(0, 0); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:23:19: 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 < a.size(); 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...