#include <bits/stdc++.h>
using namespace std;
int main(){
long long n,m;
cin>>n>>m;
long long arr[n];
for(int i = 0;i<n;i++){
cin>>arr[i];
}
long long l = n/2;
vector<long long> v;
for(int i = 0;i<(1<<l);i++){
long long s = 0;
for(int j = 0;j<l;j++){
if(i&(1<<j)){
s+=arr[j];
}
}
v.push_back(s);
}
long long all = 0;
for(int i = 0;i<(1<<(n-l));i++){
long long s= 0;
for(int j= l;j<n;j++){
if(i&(1<<(j-l))){
s+=arr[j];
}
}
int it = lower_bound(v.begin(),v.end(),(m-s)+1)-v.begin();
all+=it;
}
cout<<all;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
848 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1356 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
1356 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
134 ms |
4500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
182 ms |
8628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |