Submission #305014

#TimeUsernameProblemLanguageResultExecution timeMemory
305014arnold518Packing Biscuits (IOI20_biscuits)C++14
0 / 100
8 ms512 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll X, A[100], P[100]; ll dp[100][100]; ll solve(int bit, int con) { if(bit==-1) return 1; ll &ret=dp[bit][con]; if(ret!=-1) return ret; ll t=P[con]&((1ll<<(bit+1))-1); if(t>P[bit]) t=P[bit], con=bit; ret=0; if((1ll<<bit)>t) { ret+=solve(bit-1, con); } else { ret+=solve(bit-1, bit-1)+solve(bit-1, con); } return ret; } ll count_tastiness(ll _X, vector<ll> _A) { X=_X; memset(A, 0, sizeof(A)); for(int i=0; i<_A.size(); i++) A[i]=_A[i]; for(int i=0; i<60; i++) P[i]=(1ll<<i)*A[i]; for(int i=1; i<60; i++) P[i]+=P[i-1]; for(int i=0; i<60; i++) P[i]/=X; memset(dp, -1, sizeof(dp)); return solve(59, 59); }

Compilation message (stderr)

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