제출 #432404

#제출 시각아이디문제언어결과실행 시간메모리
432404MOUF_MAHMALAT비스킷 담기 (IOI20_biscuits)C++14
0 / 100
2 ms332 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; vector<ll>a; ll x,n,dp[65]; ll best(ll d) { if(d==-1) return 1; ll &r=dp[d]; if(r!=-1) return r; r=best(d-1); ll c=0; for(ll i=d;i>=0;i--) { c+=a[i]/(1<<(d-i)); if(c==x) return r+=best(i-1); } return r; } long long count_tastiness(ll X, vector<ll> A) { x=X,a=A,n=a.size(); for(ll i=0; i<n; i++) { if(a[i]<x) { a[i]=0; continue; } ll op=a[i]-x; a[i]=x; if(i<n-1) a[i+1]+=op/2; } memset(dp,-1,sizeof dp); return best(n-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...