제출 #1192586

#제출 시각아이디문제언어결과실행 시간메모리
1192586Ak_16비스킷 담기 (IOI20_biscuits)C++20
0 / 100
1095 ms320 KiB
#include <iostream> #include "biscuits.h" #include <vector> using namespace std; #define int long long int x,k; int a[1000]; int po[61]; int con[1000]; int ps[1000]; int bef[1000]; int yh[1000]; int auk[1000]; int n1; int fin(int z){ if(z<0){return 0;} if(z==0){return 1;} int sp; for(int i=0; i<=60; i++){ if(po[i]<=i){sp=i;} } return bef[sp] + fin( min(z - po[sp], auk[sp]) ); } int count_tastiness(int xa, vector<int> ah){ x = xa; k = ah.size(); for(int i=0; i<=60; i++){a[i]=0; auk[i] = -1;} for(int i=0; i<k; i++){ a[i] = ah[i]; } po[0]=1; for(int i=1; i<=60; i++){ po[i] = 2*po[i-1]; } for(int i=0; i<60; i++){ if(a[i]>=x){ int xx = (a[i]-x)/2; a[i] -= 2*xx; a[i+1] += xx; } } ps[0] = a[0]; for(int i=1; i<60; i++){ ps[i] = ps[i-1] + po[i] * a[i]; } bef[0]=1; for(int i=0; i<=59; i++){ if(a[i]>=x){ con[i] = bef[i]; } else { n1 = ps[i] / x; if(n1 < po[i]){con[i]=0;} else { auk[i] = n1 - po[i]; con[i] = fin(auk[i]); } } bef[i+1] = bef[i] + con[i]; } return bef[60]; }
#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...