/*
░░░░░░░░░░░░░░░░▄▄█▀▀██▄▄░░░░░░░
░░░░░░░░░░░░░▄█▀▀░░░░░░░▀█░░░░░░
░░░░░░░░░░░▄▀░░░░░░░░░░░░░█░░░░░
░░░░░░░░░▄█░░░░░░░░░░░░░░░█░░░░░
░░░░░░░██▀░░░░░░░▄▄▄░░▄░█▄█▄░░░░
░░░░░▄▀░░░░░░░░░░████░█▄██░▀▄░░░
░░░░█▀░░░░░░░░▄▄██▀░░█████░██░░░
░░░█▀░░░░░░░░░▀█░▀█▀█▀▀▄██▄█▀░░░
░░░██░░░░░░░░░░█░░█░█░░▀▀▄█▀░░░░
░░░░█░░░░░█░░░▀█░░░░▄░░░░░▄█░░░░
░░░░▀█░░░░███▄░█░░░░░░▄▄▄▄█▀█▄░░
░░░░░▀██░░█▄▀▀██░░░░░░░░▄▄█░░▀▄░
░░░░░░▀▀█▄░▀▄▄░▄░░░░░░░███▀░░▄██
░░░░░░░░░▀▀▀███▀█▄░░░░░█▀░▀░░░▀█
░░░░░░░░░░░░▄▀░░░▀█▄░░░░░▄▄░░▄█▀
░░░▄▄▄▀▀▀▀▀█▀░░░░░█▄▀▄▄▄▄▄▄█▀▀░░
░▄█░░░▄██▀░░░░░░░░░█▄░░░░░░░░░░░
█▀▀░▄█░░░░░░░░░░░░░░▀▀█▄░░░░░░░░
█░░░█░░░░░░░░░░░░░░░░░░█▄░░░░░░░*/
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
const ll mod = 1000000007;
const ll nmax=100010;
#define int ll
int n, m, a[44], ans;
vector <int> s1, s2;
int32_t main(){
ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
cin>>n>>m;
s1.pb(0);
s2.pb(0);
for(int i=1; i<=n; i++) cin>>a[i];
int mid=(1+n)>>1;
for(int i=1; i<=mid; i++){
int s=s1.size();
for(int j=0; j<s; j++) s1.pb(s1[j]+a[i]);
}
sort(s1.begin(), s1.end());
for(int i=mid+1; i<=n; i++){
int s=s2.size();
for(int j=0; j<s; j++) s2.pb(s2[j]+a[i]);
}
//for(int i: s1) cout<<i<<" "; cout<<endl;
for(int x: s2){
ans+=upper_bound(s1.begin(), s1.end(), m-x)-s1.begin();
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
424 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
380 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
2544 KB |
Output is correct |
2 |
Correct |
91 ms |
5576 KB |
Output is correct |
3 |
Correct |
425 ms |
20924 KB |
Output is correct |
4 |
Correct |
91 ms |
5480 KB |
Output is correct |
5 |
Correct |
11 ms |
1652 KB |
Output is correct |
6 |
Correct |
6 ms |
1016 KB |
Output is correct |
7 |
Correct |
11 ms |
1648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
2932 KB |
Output is correct |
2 |
Correct |
29 ms |
2544 KB |
Output is correct |
3 |
Correct |
179 ms |
10460 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
6 ms |
1016 KB |
Output is correct |
6 |
Correct |
12 ms |
1652 KB |
Output is correct |
7 |
Correct |
11 ms |
1652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
4456 KB |
Output is correct |
2 |
Correct |
130 ms |
8604 KB |
Output is correct |
3 |
Correct |
122 ms |
8604 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
46 ms |
8604 KB |
Output is correct |
6 |
Correct |
165 ms |
20824 KB |
Output is correct |
7 |
Correct |
68 ms |
8544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
267 ms |
16852 KB |
Output is correct |
2 |
Correct |
24 ms |
2416 KB |
Output is correct |
3 |
Correct |
10 ms |
1016 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
6 ms |
1016 KB |
Output is correct |
6 |
Correct |
154 ms |
16724 KB |
Output is correct |
7 |
Correct |
10 ms |
1652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
2416 KB |
Output is correct |
2 |
Correct |
84 ms |
5480 KB |
Output is correct |
3 |
Correct |
8 ms |
1016 KB |
Output is correct |
4 |
Correct |
9 ms |
1012 KB |
Output is correct |
5 |
Correct |
66 ms |
8672 KB |
Output is correct |
6 |
Correct |
18 ms |
2416 KB |
Output is correct |
7 |
Correct |
165 ms |
20948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
343 ms |
20960 KB |
Output is correct |
2 |
Correct |
29 ms |
2412 KB |
Output is correct |
3 |
Correct |
9 ms |
1016 KB |
Output is correct |
4 |
Correct |
422 ms |
20896 KB |
Output is correct |
5 |
Correct |
74 ms |
10720 KB |
Output is correct |
6 |
Correct |
11 ms |
1652 KB |
Output is correct |
7 |
Correct |
19 ms |
2928 KB |
Output is correct |