제출 #552065

#제출 시각아이디문제언어결과실행 시간메모리
552065neki비스킷 담기 (IOI20_biscuits)C++14
0 / 100
138 ms380 KiB
#include <bits/stdc++.h> using namespace std; #define vc vector #define ll __int128 #define loop(i, a, b) for(ll i=a;i<b;++i) #define pool(i, a, b) for(ll i=a-1;i>=b;--i) ll min(ll a, ll b){return (a>b) ? b:a;} long long count_tastiness(long long X, vc<long long> A){ ll x=X; ll k=A.size(); ll mk=124; vc<ll> a(mk); loop(i, 0, k) a[i+1]=A[i]; vc<ll> dp(mk, 0);dp[0]=1; loop(ti, 1, mk){ dp[ti]=dp[ti-1]; if(a[ti]>=x) dp[ti]+=dp[ti-1]; else{ ll i=ti; vc<ll> na=a; pool(j, ti, 1){ ll rpot=((ll)1<<(i-j)); ll kok=min((x-na[i]) * rpot, na[j]- na[j]%rpot); na[i]+=kok/rpot; na[j]-=kok; if(x>na[i]) na[j-1]+=2 * na[j]; else{ if(na[j]>=x){dp[ti]+=dp[j];break;} else{ dp[ti]+=dp[j-1]; i=j; } } } } } return (long long ) dp[mk-1]; }
#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...