# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86815 | igzi | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 449 ms | 21296 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>
#define maxN 41
using namespace std;
long long n,m,tmp,j,i,ans,a[maxN];
vector <long long> v,u;
int main()
{
cin>>n>>m;
for(i=0;i<n;i++) cin>>a[i];
v.push_back(0);
for(i=0;i<n/2;i++){
tmp=v.size();
for(j=0;j<tmp;j++){
if(a[i]+v[j]>m) continue;
v.push_back(a[i]+v[j]);
}
}
u.push_back(0);
for(i=n/2;i<n;i++){
tmp=u.size();
for(j=0;j<tmp;j++){
if(a[i]+u[j]>m) continue;
u.push_back(a[i]+u[j]);
}
}
sort(u.begin(),u.end());
for(i=0;i<v.size();i++){
ans+=lower_bound(u.begin(),u.end(),m-v[i]+1)-u.begin();
}
cout<<ans<<endl;
return 0;
}
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... |