Submission #1034676

#TimeUsernameProblemLanguageResultExecution timeMemory
1034676Marco_EscandonPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1061 ms348 KiB
#include<bits/stdc++.h> //#include "biscuits.h" using namespace std; typedef long long ll; vector<ll> temp; ll sol(ll i, ll j) { if(i==-1) return 1; if(i<-1||j<(1ll<<i)) return 0; ll h=-1; if(j>(1LL<<i)) h=min((ll)(log2l(j-(1LL<<i))),i-1LL); ll ac=sol(h,j-(1LL<<i)); for(int k=0; k<h; k++) ac+=sol(k,temp[k]); if(h!=-1)ac++; return ac; } long long count_tastiness(long long x, std::vector<long long> a) { a.resize(63); temp=a;ll ac=0; for(int i=0; i<a.size()-1; i++) { a[i+1]+=max(a[i]-x,0LL)/2; if((a[i]-x)%2==1) a[i]=x+1; else a[i]=min(a[i],x); } for(int i=0; i<a.size(); i++) { ac+=(a[i]<<i); temp[i]=ac/x; } ll ac2=0; for(int i=0; i<63; i++) { ac2+=sol(i,temp[i]); } return ac2+1; }

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