Submission #43503

# Submission time Handle Problem Language Result Execution time Memory
43503 2018-03-16T19:02:01 Z Hassoony Ice Hockey World Championship (CEOI15_bobek) C++14
10 / 100
124 ms 33648 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const int MX=42;
ll n,m,a[MX];
vector<ll>v1,v2;
void calc(int x,ll sum,int fin){
    if(x==fin){
        v1.push_back(sum);
        return;
    }
    calc(x+1,sum+a[x],fin);
    calc(x+1,sum,fin);
}
int main(){
    scanf("%lld%lld",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    calc(0,0,n/2+1);
    v2=v1;v1.clear();
    calc(n/2+1,0,n);
    ll ans=0;
    for(auto pp:v2){
        ans+=upper_bound(v1.begin(),v1.end(),m-pp)-v1.begin();
    }
    cout<<ans<<endl;
}

Compilation message

bobek.cpp: In function 'int main()':
bobek.cpp:17:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld",&n,&m);
                            ^
bobek.cpp:19:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&a[i]);
                            ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 464 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 4820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 4824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 17096 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 17096 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 33648 KB Output isn't correct
2 Halted 0 ms 0 KB -