This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=42;
int n,x[N];
ll a[N],m,kq;
vector<ll> e;
void duyet(int i,int l,ll s)
{
if(i==l+1)
{
if(l==n/2) e.push_back(s);
else kq+=upper_bound(e.begin(),e.end(),m-s)-e.begin();
return;
}
duyet(i+1,l,s);
duyet(i+1,l,s+a[i]);
}
int main()
{
cin>>n>>m;
for(int i=1;i<=n;++i) cin>>a[i];
duyet(1,n/2,0);
sort(e.begin(),e.end());
duyet(n/2+1,n,0);
cout<<kq;
}
# | 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... |