제출 #1022241

#제출 시각아이디문제언어결과실행 시간메모리
1022241JakobZorz비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1031 ms1112 KiB
#include"biscuits.h" #include<unordered_map> #include<iostream> typedef long long ll; using namespace std; ll x; ll coins[62]; ll s[62]; ll count(ll n){ if(n==1) return 1; if(n<0) return 0; int i=0; ll pw2=2; while(pw2<n){ pw2*=2; i++; } pw2/=2; return count(pw2)+count(min(n,1+s[i]/x)-pw2); } ll count_tastiness(ll X,vector<ll>a){ x=X; for(int i=0;i<62;i++){ coins[i]=0; } for(int i=0;i<(int)a.size();i++) coins[i]=a[i]; for(int i=0;i<62;i++){ ll num=(coins[i]-x)/2; if(num>0){ coins[i+1]+=num; coins[i]-=2*num; } s[i]=(1LL<<i)*coins[i]; if(i) s[i]+=s[i-1]; } return count(1LL<<62); }
#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...