This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <map>
#include <algorithm>
#define int long long
using namespace std;
int n,m;
int ans=1;
int const N=45;
int a[N];
int dfs(int i,int s,bool w=0)
{
if (s>m)
return 0;
if (i==n)
return (s<=m&&w);
return (dfs(i+1,s)+dfs(i+1,s+a[i],1)+w);
}
inline void solve()
{
cin>>n>>m;
int x=0;
for (int i=0;i<n;i++)
{
cin>>a[i];
x+=a[i];
}
if (x<=m)
{
int z=1;
for (int i=0;i<n;i++)
{
z*=2;
}
cout<<z<<endl;return;
}
sort(a,a+n);
cout<<dfs(0,0,1)<<endl;
}
signed main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
solve();
}
# | 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... |
# | 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... |