이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "biscuits.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const int K = 60;
ll count_tastiness(ll X, vector<ll> A){
while(A.size() < K+1) A.pb(0);
A.pb(0);
vector<ll> S(K+1);
for(int i = 0; i < K; i++){
if(i) S[i]+=S[i-1];
S[i]+=A[i]*(1LL<<i);
}
unordered_map<ll, ll> dp;
dp[0] = 1;
function<ll(ll)> DP = [&](ll x){
if(x < 0) return 0LL;
if(dp.find(x) != dp.end()) return dp[x];
int i = 63-__builtin_clzll(x);
dp[x] = DP((1LL<<i)-1)+DP(min(x, S[i]/X)-(1LL<<i));
return dp[x];
};
return DP(1LL<<K);
}
| # | 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... |