# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101754 | jamielim | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 475 ms | 8668 KiB |
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;
int n;
long long m;
long long arr[45];
int k,l;
int main(){
scanf("%d%lld",&n,&m);
for(int i=0;i<n;i++)scanf("%lld",&arr[i]);
k=n/2; l=n-k;
long long fh[(1<<k)];
for(int i=0;i<(1<<k);i++){
int bm=i;
long long cur=0;
while(bm&(-bm)){
cur+=arr[__builtin_ctz(bm)];
bm-=(bm&(-bm));
}
fh[i]=cur;
}
sort(fh,fh+(1<<k));
long long ans=0;
for(int i=0;i<(1<<l);i++){
int bm=i;
long long cur=0;
while(bm&(-bm)){
cur+=arr[__builtin_ctz(bm)+k];
bm-=(bm&(-bm));
}
cur=m-cur;
ans+=upper_bound(fh,fh+(1<<k),cur)-fh;
}
printf("%lld",ans);
}
Compilation message (stderr)
# | 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... |