이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "biscuits.h"
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 20000
#define pa pair<ll, ll>
#define ld long double
ll k, a[mn], x;
map<ll, ll> dp[mn];
ll solve(ll ind){
if(dp[ind].find(a[ind])!=dp[ind].end()) return dp[ind][a[ind]];
if(ind>=k and a[ind]<x) return 1;
ll ret=0;
if(a[ind]>=x){
a[ind+1]+=(a[ind]-x)/2;
ret+=solve(ind+1);
a[ind+1]-=(a[ind]-x)/2;
}
a[ind+1]+=(a[ind])/2;
ret+=solve(ind+1);
a[ind+1]-=(a[ind])/2;
dp[ind][a[ind]]=ret;
return ret;
}
ll count_tastiness(ll X, vector<ll> A){
k=A.size();
x=X;loop(i, 0, k) a[i]=A[i];
return solve(0);
}
# | 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... |