# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43503 | Hassoony | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 124 ms | 33648 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;
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 (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... |