#include <bits/stdc++.h>
using namespace std;
int main(){
long long n,m,say=0;
cin>>n>>m;
long long a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
for(long long x=0;x<(1<<n);x++){
long long sum=0;
for(long long i=0;i<n;i++){
if(x&(1<<i)){
sum+=a[i];
}
if(sum>m){
break;
}
}
if(sum<=m){
say++;
}
}
cout<<say;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
292 KB |
Output is correct |
2 |
Correct |
5 ms |
204 KB |
Output is correct |
3 |
Correct |
9 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
5 ms |
204 KB |
Output is correct |
6 |
Correct |
72 ms |
268 KB |
Output is correct |
7 |
Correct |
2 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
264 KB |
Output is correct |
2 |
Correct |
18 ms |
204 KB |
Output is correct |
3 |
Correct |
5 ms |
204 KB |
Output is correct |
4 |
Correct |
5 ms |
204 KB |
Output is correct |
5 |
Correct |
74 ms |
204 KB |
Output is correct |
6 |
Correct |
9 ms |
284 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |