이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#ifndef SKY
#include "biscuits.h"
#endif // SKY
using namespace std;
#define N 65
#define ll long long
#define fs first
#define sc second
#define ii pair<int,int>
#define pb push_back
const int num_bit=60;
int n;
vector<ll>a;
ll mp[N][200010];
ll m;
vector<int>luu[N];
ll get(ll sl,int pos)
{
if(pos==num_bit)
return 1;
if(mp[pos][sl]!=-1)
return mp[pos][sl];
ll res=get((sl+a[pos])/2,pos+1);
if(sl+a[pos]>=m)
res+=get((sl+a[pos]-m)/2,pos+1);
return(mp[pos][sl]=res);
}
ll count_tastiness(ll cc, vector<ll> vec)
{
n=vec.size();
a=vec;
m=cc;
while(n<60)
a.pb(0),n++;
for(int i=0;i<num_bit;i++)
luu[i].clear();
memset(mp,-1,sizeof(mp));
return get(0,0);
}
#ifdef SKY
int main()
{
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
ll x,k;
cin>>x>>k;
vector<ll>a(k);
for(int i=0;i<k;i++)
{
cin>>a[i];
// a[i]=1ll*rand()*rand()%((ll)1e9/(i+1))+1;
}
cout<<count_tastiness(x,a);
return 0;
}
#endif
# | 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... |