Submission #101754

# Submission time Handle Problem Language Result Execution time Memory
101754 2019-03-20T00:17:46 Z jamielim Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
475 ms 8668 KB
#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

bobek.cpp: In function 'int main()':
bobek.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%lld",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~~
bobek.cpp:11:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++)scanf("%lld",&arr[i]);
                         ~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 384 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 384 KB Output is correct
7 Correct 3 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 588 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 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 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 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 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 896 KB Output is correct
2 Correct 93 ms 2404 KB Output is correct
3 Correct 437 ms 8668 KB Output is correct
4 Correct 99 ms 2432 KB Output is correct
5 Correct 11 ms 896 KB Output is correct
6 Correct 6 ms 512 KB Output is correct
7 Correct 11 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1408 KB Output is correct
2 Correct 32 ms 768 KB Output is correct
3 Correct 161 ms 4480 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 5 ms 640 KB Output is correct
6 Correct 12 ms 864 KB Output is correct
7 Correct 11 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 1500 KB Output is correct
2 Correct 138 ms 2400 KB Output is correct
3 Correct 130 ms 2304 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 41 ms 2552 KB Output is correct
6 Correct 148 ms 8572 KB Output is correct
7 Correct 44 ms 2304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 316 ms 4472 KB Output is correct
2 Correct 22 ms 768 KB Output is correct
3 Correct 10 ms 512 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 6 ms 512 KB Output is correct
6 Correct 100 ms 4352 KB Output is correct
7 Correct 10 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 768 KB Output is correct
2 Correct 85 ms 2304 KB Output is correct
3 Correct 7 ms 512 KB Output is correct
4 Correct 8 ms 512 KB Output is correct
5 Correct 76 ms 2432 KB Output is correct
6 Correct 13 ms 768 KB Output is correct
7 Correct 152 ms 8568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 346 ms 8564 KB Output is correct
2 Correct 33 ms 768 KB Output is correct
3 Correct 9 ms 512 KB Output is correct
4 Correct 475 ms 8668 KB Output is correct
5 Correct 77 ms 4480 KB Output is correct
6 Correct 9 ms 768 KB Output is correct
7 Correct 19 ms 1280 KB Output is correct