Submission #413422

#TimeUsernameProblemLanguageResultExecution timeMemory
413422mosiashvililukaPacking Biscuits (IOI20_biscuits)C++17
42 / 100
111 ms66252 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; long long a,b,c,d,e,i,j,ii,jj,zx,xc,f[209],x,dp[209][20009]; long long tes,te; long long count_tastiness(long long Xx, std::vector<long long> A) { x=Xx; a=A.size();a--; for(i=0; i<=206; i++){ f[i]=0; } for(i=0; i<=206; i++){ for(j=0; j<=20003; j++){ dp[i][j]=0; } } for(i=0; i<=a; i++){ f[i]=A[i]; } for(i=0; ; i++){ if(f[i]==0&&i>A.size()){ a=i; break; } if(f[i]>x+1){ f[i+1]+=(f[i]-x)/2; f[i]=x+(f[i]-x)%2; } } a=A.size()+134; dp[0][0]=1; for(i=0; i<a; i++){ for(j=0; j<=20003; j++){ if(dp[i][j]==0) continue; dp[i+1][(j+f[i])/2]+=dp[i][j]; if(j+f[i]>=x) dp[i+1][(j+f[i]-x)/2]+=dp[i][j]; } } //f[a]=0;pasuxi=dp[a][0] return dp[a][0]; } /*int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>tes; for(te=1; te<=tes; te++){ cin>>a>>x; vector <long long> A; for(i=0; i<a; i++){ cin>>c; A.push_back(c); } cout<<count_tastiness(x,A)<<endl; } return 0; }*/

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:21:16: 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]
   21 |   if(f[i]==0&&i>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...