Submission #1034879

#TimeUsernameProblemLanguageResultExecution timeMemory
1034879Marco_EscandonPacking Biscuits (IOI20_biscuits)C++17
100 / 100
59 ms1372 KiB
#include<bits/stdc++.h> //#include "biscuits.h" using namespace std; typedef long long ll; vector<ll> temp; map<ll,ll> mapa; ll sol(ll n) { if(n<=0) return 1; if(n==1) return 2; if(mapa[n]!=0) return mapa[n]; ll bs=0; for(ll i=0; i<63; i++) { if((1LL<<i)<n&&n<=(1LL<<(i+1))) { bs=sol(1LL<<i)+sol(min(n,1+temp[i])-(1LL<<i))-2; } } return mapa[n]=bs+1; } 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(); i++) { ac+=(a[i]<<i); temp[i]=ac/x; } mapa.clear(); return sol(2e18)-1; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:26:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  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...