이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const LL INF = (LL)1e9 + 7;
const LL NS = (LL)1e5 + 4;
LL dp[64], mxget[64];
LL count_tastiness(LL x, vector<LL> a) {
while((int)a.size() < 60) a.push_back(0);
memset(dp, 0, sizeof(dp));
memset(mxget, 0, sizeof(mxget));
for(LL i = 0; i < (LL)a.size(); ++i){
mxget[i] = a[i];
if(i) mxget[i] += mxget[i - 1] / 2;
}
for(LL i = 0; i < (LL)a.size(); ++i){
if(mxget[i] >= x){
LL need = max(0ll, x - a[i]) * 2;
for(LL last = i - 1; last >= 0; --last){
if(mxget[last] >= x + need){
if(last) dp[i] += dp[last - 1];
else dp[i] += 1;
need = max(0ll, need + x - a[last]) * 2;
}
else{
need = max(0ll, need - a[last]) * 2;
}
}
if(!need) ++dp[i];
}
if(i) dp[i] += dp[i - 1];
else dp[i] += 1;
}
return dp[(LL)a.size() - 1];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |