제출 #620996

#제출 시각아이디문제언어결과실행 시간메모리
620996KLPP비스킷 담기 (IOI20_biscuits)C++14
33 / 100
57 ms30468 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) typedef long long int lld; lld arr[100]; int k; vector<lld> V; vector<lld> NXT; lld ans; lld DP[100][30000]; lld X; lld calc(int pos, int carry){ //cout<<pos<<" "<<carry<<endl; if(pos==60){ return 1; } if(DP[pos][carry]!=-1)return DP[pos][carry]; DP[pos][carry]=calc(pos+1,(carry+arr[pos])/2); if(carry+arr[pos]>=X){ DP[pos][carry]+=calc(pos+1,(carry+arr[pos]-X)/2); } return DP[pos][carry]; } long long count_tastiness(long long x, std::vector<long long> a) { rep(i,0,100)arr[i]=0; V.clear(); NXT.clear(); k=a.size(); rep(i,0,k)arr[i]=a[i]; rep(i,0,60){ if(arr[i]>=2*x+1){ lld val=(arr[i]-2*x-1)/2; arr[i+1]+=val; arr[i]-=2*val; } while(arr[i]>=2*x+1){ arr[i]-=2; arr[i+1]++; } } rep(i,0,60){ rep(j,0,2*x+1){ DP[i][j]=-1; } } V.push_back(0); ans=0; X=x; return calc(0,0); }
#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...