#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
3 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
1020 KB |
Output is correct |
2 |
Correct |
93 ms |
2548 KB |
Output is correct |
3 |
Correct |
453 ms |
8684 KB |
Output is correct |
4 |
Correct |
82 ms |
2548 KB |
Output is correct |
5 |
Correct |
10 ms |
892 KB |
Output is correct |
6 |
Correct |
6 ms |
640 KB |
Output is correct |
7 |
Correct |
9 ms |
1020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
1528 KB |
Output is correct |
2 |
Correct |
27 ms |
1020 KB |
Output is correct |
3 |
Correct |
174 ms |
4592 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
640 KB |
Output is correct |
6 |
Correct |
10 ms |
1020 KB |
Output is correct |
7 |
Correct |
10 ms |
1020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
1528 KB |
Output is correct |
2 |
Correct |
140 ms |
2548 KB |
Output is correct |
3 |
Correct |
150 ms |
2548 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
36 ms |
2548 KB |
Output is correct |
6 |
Correct |
157 ms |
8684 KB |
Output is correct |
7 |
Correct |
48 ms |
2548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
336 ms |
4592 KB |
Output is correct |
2 |
Correct |
23 ms |
1020 KB |
Output is correct |
3 |
Correct |
10 ms |
768 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
768 KB |
Output is correct |
6 |
Correct |
105 ms |
4632 KB |
Output is correct |
7 |
Correct |
10 ms |
1020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
892 KB |
Output is correct |
2 |
Correct |
86 ms |
2548 KB |
Output is correct |
3 |
Correct |
7 ms |
768 KB |
Output is correct |
4 |
Correct |
8 ms |
768 KB |
Output is correct |
5 |
Correct |
70 ms |
2548 KB |
Output is correct |
6 |
Correct |
13 ms |
1020 KB |
Output is correct |
7 |
Correct |
140 ms |
8684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
346 ms |
8692 KB |
Output is correct |
2 |
Correct |
26 ms |
1020 KB |
Output is correct |
3 |
Correct |
10 ms |
768 KB |
Output is correct |
4 |
Correct |
439 ms |
8684 KB |
Output is correct |
5 |
Correct |
59 ms |
4592 KB |
Output is correct |
6 |
Correct |
10 ms |
1020 KB |
Output is correct |
7 |
Correct |
16 ms |
1528 KB |
Output is correct |